%PDF- %PDF-
Direktori : /usr/src/node-v0.10.4/deps/npm/node_modules/once/ |
Current File : //usr/src/node-v0.10.4/deps/npm/node_modules/once/README.md |
# once Only call a function once. ## usage ```javascript 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: ```javascript // 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.