Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/component/once
- Owner: component
- Created: 2013-02-19T18:36:15.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-08-21T17:32:57.000Z (over 11 years ago)
- Last Synced: 2024-05-08T17:10:49.680Z (8 months ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 6
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
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