Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/timeout
Timeout function decorator
https://github.com/component/timeout
Last synced: 13 days ago
JSON representation
Timeout function decorator
- Host: GitHub
- URL: https://github.com/component/timeout
- Owner: component
- Created: 2013-05-22T16:30:01.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-22T16:43:33.000Z (over 11 years ago)
- Last Synced: 2024-05-08T17:06:36.388Z (8 months ago)
- Language: JavaScript
- Size: 90.8 KB
- Stars: 7
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# timeout
Timeout function decorator
## Installation
$ component install component/timeout
## Example
```js
var timeout = require('timeout');function something(fn) {
setTimeout(function(){
fn(null, 'results');
}, 1000);
}something = timeout(something, 500);
```## API
### timeout(callback, ms)
Apply timeout of `ms` to `callback` and return the new function.
## License
MIT