once.js 232 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 module.exports = function once(fn) { var timeout var args return function() { args = arguments if (timeout) { return } timeout = setTimeout(function() { fn.apply(this, args) timeout = null args = null }, 0) } }