Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aichholzer/pancho
😴 Your applications also deserve a nap...
https://github.com/aichholzer/pancho
delay nodejs-sleep server server-sleep sleep wait
Last synced: 25 days ago
JSON representation
😴 Your applications also deserve a nap...
- Host: GitHub
- URL: https://github.com/aichholzer/pancho
- Owner: aichholzer
- License: mit
- Created: 2016-09-19T11:22:32.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-23T12:11:01.000Z (over 4 years ago)
- Last Synced: 2024-04-23T19:24:26.074Z (7 months ago)
- Topics: delay, nodejs-sleep, server, server-sleep, sleep, wait
- Language: JavaScript
- Homepage:
- Size: 60.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pancho
[![Greenkeeper badge](https://badges.greenkeeper.io/aichholzer/pancho.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/aichholzer/pancho.svg?branch=master)](https://travis-ci.org/aichholzer/pancho)
[![Downloads](https://img.shields.io/npm/dt/pancho.svg)](https://www.npmjs.com/package/pancho)Your applications also deserve a nap.
### Install
```
npm i pancho
```### Use
`pancho` returns a promise, making it easy to control your program's flow after "waking up".
`pancho` takes arguments in the form of:- pancho(`int`) - Sleep for `int` seconds,
- pancho(`int`, `int`) - Sleep for a random amount of seconds, defined by (`min`, `max`),
- pancho('`natural language`') - Sleep for the specified time.```
const nap = require('pancho');nap(1).then(duration => {
// Your program slept for 1 second.
// duration = Duration of the nap, in milliseconds.
});nap(1, 3).then(duration => {
// Your program slept for a random amount of seconds (between 1 and 3).
// duration = Duration of the nap, in milliseconds.
});nap('3.5 seconds').then(duration => {
// Your program slept for 3.5 seconds.
// duration = Duration of the nap, in milliseconds.
});nap('5 minutes').then(duration => {
// Your program slept for 5 minutes.
// duration = Duration of the nap, in milliseconds.
});
```### Contribute
```
fork https://github.com/aichholzer/pancho/
```### License
[MIT](https://github.com/aichholzer/pancho/blob/master/LICENSE)