Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanong committed Dec 15, 2014
0 parents commit 40613a8
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store*
7 changes: 7 additions & 0 deletions .travis.yml
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"
22 changes: 22 additions & 0 deletions LICENSE
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.
39 changes: 39 additions & 0 deletions README.md
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/
8 changes: 8 additions & 0 deletions index.js
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)
})
}
30 changes: 30 additions & 0 deletions package.json
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"
]
}
16 changes: 16 additions & 0 deletions test/test.js
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)
})
})

0 comments on commit 40613a8

Please sign in to comment.