Skip to content

Commit

Permalink
Merge pull request #1309 from balloonzzq/fix-performance
Browse files Browse the repository at this point in the history
Optimize scheduler size and performance
  • Loading branch information
yuanyan authored Aug 30, 2019
2 parents fff9a18 + 83cc827 commit 45fdcdb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/rax/src/vdom/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ export function schedule(callback) {

// Flush before next render
export function flush() {
let callbacks = updateCallbacks;
if (callbacks.length !== 0) {
updateCallbacks = [];
callbacks.forEach(callback => callback());
let callback;
while (callback = updateCallbacks.shift()) {
callback();
}
}

Expand All @@ -34,9 +33,8 @@ export function scheduleEffect(callback) {
}

export function flushEffect() {
let callbacks = effectCallbacks;
if (callbacks.length !== 0) {
effectCallbacks = [];
callbacks.forEach(callback => callback());
let callback;
while (callback = effectCallbacks.shift()) {
callback();
}
}

0 comments on commit 45fdcdb

Please sign in to comment.