mirror of
https://github.com/nodejs/node.git
synced 2025-05-19 23:36:56 +00:00

- node-gyp@0.6.5 - abstracted-out configs - publishing over proxies - bugfixes to all the deps
549 B
549 B
once
Only call a function once.
usage
var once = require('once')
function load (file, cb) {
cb = once(cb)
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}
Or add to the Function.prototype in a responsible way:
// only has to be done once
require('once').proto()
function load (file, cb) {
cb = cb.once()
loader.load('file')
loader.once('load', cb)
loader.once('error', cb)
}
Ironically, the prototype feature makes this module twice as complicated as necessary.