Files: ec5f24a6f4ba05019584fb51d27668e5766a4963 / lib / invalidate-next-tick.js
266 bytesRaw
1 | var queue = [] |
2 | |
3 | module.exports = function (item) { |
4 | if (queue.length === 0) { |
5 | setImmediate(flush) |
6 | } |
7 | queue.push(item) |
8 | } |
9 | |
10 | function flush () { |
11 | while (queue.length) { |
12 | var item = queue.pop() |
13 | if (!item.bound) { |
14 | item.invalidated = true |
15 | } |
16 | } |
17 | } |
18 |
Built with git-ssb-web