Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/component/timeout

Timeout function decorator
https://github.com/component/timeout

Last synced: 13 days ago
JSON representation

Timeout function decorator

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