File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
import options from './options' ;
2
+ import { defer } from './util' ;
2
3
import { renderComponent } from './vdom/component' ;
3
4
4
5
/** Managed queue of dirty components to be re-rendered */
@@ -7,11 +8,10 @@ let items = [];
7
8
8
9
export function enqueueRender ( component ) {
9
10
if ( ! component . _dirty && ( component . _dirty = true ) && items . push ( component ) == 1 ) {
10
- ( options . debounceRendering || setTimeout ) ( rerender ) ;
11
+ ( options . debounceRendering || defer ) ( rerender ) ;
11
12
}
12
13
}
13
14
14
-
15
15
export function rerender ( ) {
16
16
let p , list = items ;
17
17
items = [ ] ;
Original file line number Diff line number Diff line change @@ -7,4 +7,7 @@ export function extend(obj, props) {
7
7
return obj ;
8
8
}
9
9
10
-
10
+ /** Call a function asynchronously, as soon as possible.
11
+ * @param {Function } callback
12
+ */
13
+ export const defer = typeof Promise == 'function' ? Promise . resolve ( ) . then . bind ( Promise . resolve ( ) ) : setTimeout ;
You can’t perform that action at this time.
0 commit comments