Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juliangruber/co-wait
setTimeout generator style
https://github.com/juliangruber/co-wait
Last synced: about 1 month ago
JSON representation
setTimeout generator style
- Host: GitHub
- URL: https://github.com/juliangruber/co-wait
- Owner: juliangruber
- Created: 2013-08-26T19:43:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-11-07T18:39:42.000Z (about 8 years ago)
- Last Synced: 2024-10-30T01:56:59.801Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 22
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-star - co-wait
README
# co-wait
setTimeout generator style.
[![build status](https://secure.travis-ci.org/juliangruber/co-wait.png)](http://travis-ci.org/juliangruber/co-wait)
## Example
```js
var wait = require('co-wait');
var co = require('co');co(function* (){
console.log(Date.now());
yield wait(1000);
console.log(Date.now());
})();
```## API
### yield wait(ms)
Wait for `ms` milliseconds before yielding.
## Installation
With [npm](https://npmjs.org) do:
```bash
npm install co-wait
```## License
(MIT)
Copyright (c) 2013 Julian Gruber <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.