node/deps/npm/node_modules/dezalgo/dezalgo.js

23 lines
368 B
JavaScript
Raw Normal View History

2014-11-05 07:08:12 +08:00
var wrappy = require('wrappy')
module.exports = wrappy(dezalgo)
2014-09-25 05:41:07 +08:00
var asap = require('asap')
function dezalgo (cb) {
var sync = true
asap(function () {
sync = false
})
return function zalgoSafe() {
var args = arguments
var me = this
if (sync)
asap(function() {
cb.apply(me, args)
})
else
cb.apply(me, args)
}
}