File tree Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Original file line number Diff line number Diff line change 1
- import { run } from '../../../common.js' ;
1
+ import { run_all } from '../../../common.js' ;
2
2
import { user_pre_effect , user_effect } from '../../reactivity/effects.js' ;
3
3
import {
4
4
current_component_context ,
@@ -9,6 +9,11 @@ import {
9
9
untrack
10
10
} from '../../runtime.js' ;
11
11
12
+ /** @param {Function } fn */
13
+ function run ( fn ) {
14
+ return fn ( ) ;
15
+ }
16
+
12
17
/**
13
18
* Legacy-mode only: Call `onMount` callbacks and set up `beforeUpdate`/`afterUpdate` effects
14
19
*/
@@ -22,7 +27,7 @@ export function init() {
22
27
if ( callbacks . b . length ) {
23
28
user_pre_effect ( ( ) => {
24
29
observe_all ( context ) ;
25
- callbacks . b . forEach ( run ) ;
30
+ run_all ( callbacks . b ) ;
26
31
// beforeUpdate might change state that affects rendering, ensure the render effects following from it
27
32
// are batched up with the current run. Avoids for example child components rerunning when they're
28
33
// now hidden because beforeUpdate did set an if block to false.
@@ -49,7 +54,7 @@ export function init() {
49
54
if ( callbacks . a . length ) {
50
55
user_effect ( ( ) => {
51
56
observe_all ( context ) ;
52
- callbacks . a . forEach ( run ) ;
57
+ run_all ( callbacks . a ) ;
53
58
} ) ;
54
59
}
55
60
}
Original file line number Diff line number Diff line change @@ -19,8 +19,3 @@ export function run_all(arr) {
19
19
arr [ i ] ( ) ;
20
20
}
21
21
}
22
-
23
- /** @param {Function } fn */
24
- export function run ( fn ) {
25
- return fn ( ) ;
26
- }
Original file line number Diff line number Diff line change 1
- import { noop , run } from '../internal/common.js' ;
1
+ import { noop , run_all } from '../internal/common.js' ;
2
2
import { subscribe_to_store } from './utils.js' ;
3
3
4
4
/**
@@ -106,14 +106,6 @@ export function writable(value, start = noop) {
106
106
return { set, update, subscribe } ;
107
107
}
108
108
109
- /**
110
- * @param {Function[] } fns
111
- * @returns {void }
112
- */
113
- function run_all ( fns ) {
114
- fns . forEach ( run ) ;
115
- }
116
-
117
109
/**
118
110
* Derived value store by synchronizing one or more readable stores and
119
111
* applying an aggregation function over its input values.
You can’t perform that action at this time.
0 commit comments