once-component

Make a method callable only once

once

Make a function or method callable only once. Useful for initialization methods that may be lazily invoked from several locations, but must only be called once, otherwise the method is a noop.

$ component install component/once
var once = require('once');
 
Foo.prototype.setup = once(function(){
  // expensive stuff here 
});

MIT