git ssb

1+

Matt McKegg / mutant



Tree: 7842de264aaac4d297a99352606ade6c44ee4d50

Files: 7842de264aaac4d297a99352606ade6c44ee4d50 / lib / release-next-tick.js

321 bytesRaw
1var queue = []
2
3module.exports = function (item) {
4 if (queue.length === 0) {
5 setImmediate(flush)
6 }
7 queue.push(item)
8}
9
10function flush () {
11 while (queue.length) {
12 var item = queue.pop()
13 if (!item.bound && typeof item.release === 'function') {
14 item.release()
15 item.release = null
16 }
17 }
18}
19

Built with git-ssb-web