Skip to content

Commit f2b14db

Browse files
committed
update 5.js
1 parent f6cacca commit f2b14db

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

5.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@ class Watcher {
1818
let callbacks = [];
1919
let pending = false;
2020

21-
function flushCallbacks () {
22-
pending = false;
23-
const copies = callbacks.slice(0);
24-
callbacks.length = 0;
25-
for (let i = 0; i < copies.length; i++) {
26-
copies[i]();
27-
}
28-
}
29-
3021
function nextTick (cb) {
3122
callbacks.push(cb);
3223

@@ -36,6 +27,15 @@ function nextTick (cb) {
3627
}
3728
}
3829

30+
function flushCallbacks () {
31+
pending = false;
32+
const copies = callbacks.slice(0);
33+
callbacks.length = 0;
34+
for (let i = 0; i < copies.length; i++) {
35+
copies[i]();
36+
}
37+
}
38+
3939
let has = {};
4040
let queue = [];
4141
let waiting = false;

0 commit comments

Comments
 (0)