Skip to content

Commit c6e61ee

Browse files
committed
0 parents  commit c6e61ee

9 files changed

+93
-0
lines changed

.github/workflows/npm-publish.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Publish Package
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
publish-npm:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-node@v1
17+
with:
18+
node-version: 12
19+
registry-url: https://registry.npmjs.org/
20+
- run: npm publish
21+
env:
22+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

Whitespace-only changes.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 ealush
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# wait - Awaitable Delay
2+
3+
Wait is a promise wrapped setTimeout. That's it.
4+
Use it for a nicer delay interface.
5+
6+
```js
7+
import wait from 'wait';
8+
9+
async function myAsyncFunction() {
10+
await wait(300);
11+
12+
// do some stuff here
13+
}
14+
```
15+
16+
You can also use it as a simple sleep for your cli apps:
17+
18+
```sh
19+
echo Hi
20+
npx wait 2000 # Will pause execution for 2 seconds.
21+
echo Bye
22+
```

cli.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
const [ms = 0] = process.argv.slice(2);
3+
4+
setTimeout(() => {}, Number(ms));

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "0.2.0",
3+
"license": "MIT",
4+
"main": "wait.js",
5+
"typings": "wait.d.ts",
6+
"name": "wait",
7+
"author": "ealush",
8+
"module": "wait.js",
9+
"bin": {
10+
"wait": "./cli.js"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/ealush/wait.git"
15+
}
16+
}

wait.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function wait(delay?: number): Promise<number>;

wait.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export default (delay = 0) =>
2+
new Promise((resolve) => setTimeout(resolve, delay));

0 commit comments

Comments
 (0)