Comparing version 0.0.7 to 0.0.8
10
index.js
// time string is the desired delay time | ||
module.exports = function(time) { | ||
module.exports = async function(time) { | ||
const delay = require('delay'); | ||
const humanInterval = require('human-interval'); | ||
async function start() { | ||
console.log('waiting for' + time); | ||
await delay(humanInterval(time)); | ||
} | ||
start(); | ||
console.log('waiting for' + time); | ||
await delay(humanInterval(time)); | ||
} |
@@ -35,3 +35,3 @@ { | ||
}, | ||
"version": "0.0.7" | ||
"version": "0.0.8" | ||
} |
@@ -5,10 +5,46 @@ # delay-cmd | ||
### Installation and Usage | ||
### CLI Installation | ||
```javascript | ||
$ npm i delay-cmd -g | ||
$ cd /c/your/project/folder | ||
$ delay-cmd two hours && npm start | ||
npm i delay-cmd -g | ||
``` | ||
### CLI Usage | ||
```javascript | ||
delay-cmd five seconds | ||
``` | ||
Put the command you want to delay after the `&&`. | ||
```javascript | ||
cd /c/path/to/yourProject | ||
delay-cmd two hours && npm start | ||
``` | ||
### node.js Usage | ||
Must be used in an async function. | ||
```javascript | ||
const delayCmd = require('delay-cmd'); | ||
await delayCmd('five seconds'); | ||
``` | ||
I made `delay-cmd` as a CLI. For node.js use I recommend implementing this: | ||
```javascript | ||
//setup | ||
const delay = require('delay'); | ||
const humanInterval = require('human-interval'); | ||
async function delayCmd(time) { | ||
console.log('waiting for' + time); | ||
await delay(humanInterval(time)); | ||
} | ||
//usage | ||
await delayCmd('five seconds'); | ||
``` | ||
### Donate! | ||
@@ -15,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2229
55
7