Run a function exactly one time
Only call a function once.
var once = require'once'cb = oncecbloaderload'file'loaderonce'load' cbloaderonce'error' cb
Or add to the Function.prototype in a responsible way:
// only has to be done oncerequire'once'protocb = cbonceloaderload'file'loaderonce'load' cbloaderonce'error' cb
Ironically, the prototype feature makes this module twice as complicated as necessary.
To check whether you function has been called, use
fn.called. Once the
function is called for the first time the return value of the original
function is saved in
fn.value and subsequent calls will continue to
return this value.
var once = require'once'cb = oncecbvar stream = createStreamstreamonce'data' cbstreamonce'end'if !cbcalled cb'not found'