-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 40613a8
Showing
7 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_js: | ||
- "0.8" | ||
- "0.10" | ||
- "0.11" | ||
language: node_js | ||
script: "npm run-script test-travis" | ||
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Jonathan Ong [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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
# timeout-then | ||
|
||
[![NPM version][npm-image]][npm-url] | ||
[![Build status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![Dependency Status][david-image]][david-url] | ||
[![License][license-image]][license-url] | ||
[![Downloads][downloads-image]][downloads-url] | ||
[![Gittip][gittip-image]][gittip-url] | ||
|
||
`setTimeout` as a promise. | ||
|
||
```js | ||
var timeout = require('timeout-then'); | ||
|
||
timeout(100).then(function () { | ||
console.log('blah'); | ||
}); | ||
``` | ||
|
||
[gitter-image]: https://badges.gitter.im/thenables/timeout-then.png | ||
[gitter-url]: https://gitter.im/thenables/timeout-then | ||
[npm-image]: https://img.shields.io/npm/v/timeout-then.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/timeout-then | ||
[github-tag]: http://img.shields.io/github/tag/thenables/timeout-then.svg?style=flat-square | ||
[github-url]: https://github.com/thenables/timeout-then/tags | ||
[travis-image]: https://img.shields.io/travis/thenables/timeout-then.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/thenables/timeout-then | ||
[coveralls-image]: https://img.shields.io/coveralls/thenables/timeout-then.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/thenables/timeout-then | ||
[david-image]: http://img.shields.io/david/thenables/timeout-then.svg?style=flat-square | ||
[david-url]: https://david-dm.org/thenables/timeout-then | ||
[license-image]: http://img.shields.io/npm/l/timeout-then.svg?style=flat-square | ||
[license-url]: LICENSE | ||
[downloads-image]: http://img.shields.io/npm/dm/timeout-then.svg?style=flat-square | ||
[downloads-url]: https://npmjs.org/package/timeout-then | ||
[gittip-image]: https://img.shields.io/gratipay/jonathanong.svg?style=flat-square | ||
[gittip-url]: https://gratipay.com/jonathanong/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
var Promise = require('native-or-bluebird') | ||
|
||
module.exports = function (interval) { | ||
return new Promise(function (resolve) { | ||
setTimeout(resolve, interval || 0) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "timeout-then", | ||
"description": "setTimeout as promised", | ||
"version": "1.0.0", | ||
"author": "Jonathan Ong <[email protected]> (http://jongleberry.com)", | ||
"license": "MIT", | ||
"repository": "thenables/timeout-then", | ||
"dependencies": { | ||
"native-or-bluebird": "1" | ||
}, | ||
"devDependencies": { | ||
"bluebird": "2", | ||
"istanbul": "0", | ||
"mocha": "2" | ||
}, | ||
"scripts": { | ||
"test": "mocha --reporter spec", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" | ||
}, | ||
"keywords": [ | ||
"settimeout", | ||
"timeout", | ||
"promise", | ||
"then" | ||
], | ||
"files": [ | ||
"index.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
var assert = require('assert') | ||
|
||
var timeout = require('..') | ||
|
||
it('should wait', function () { | ||
var blah = false | ||
|
||
setTimeout(function () { | ||
blah = true | ||
}, 5) | ||
|
||
return timeout(100).then(function () { | ||
assert(blah) | ||
}) | ||
}) |