Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/component/once

Make a method callable only once
https://github.com/component/once

Last synced: 13 days ago
JSON representation

Make a method callable only once

Awesome Lists containing this project

README

        

# 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.

## Installation

$ component install component/once

## API

```js
var once = require('once');

Foo.prototype.setup = once(function(){
// expensive stuff here
});
```

## License

MIT