# wait-a-bit

> An Event emitter based timer with argument returns

Latest version **0.0.1** (published 2018-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install wait-a-bit
pnpm add wait-a-bit
yarn add wait-a-bit
bun add wait-a-bit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-09-11 |
| First published | 2018-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | CB BEZUIDENHOUT |
| Maintainers | claytonbez |

## Links

- npm: https://www.npmjs.com/package/wait-a-bit
- Repository: https://github.com/claytonbez/wait-a-bit
- Homepage: https://github.com/claytonbez/wait-a-bit#readme
- Issues: https://github.com/claytonbez/wait-a-bit/issues
- npm.io page: https://npm.io/package/wait-a-bit

## Recent versions

- 0.0.1 (latest) — 2018-09-11

## README

## Wait-a-bit
An Event Emitter based timer with return arguments

### Install
`npm install wait-a-bit -save`

### Usage Example

    var  waitABit  	=  require('wait-a-bit');
    var  timer  	=  new waitABit();
    
    timer.set(2000); //milliseconds
    
    timer.on('expire',function(returnArguments){
	    console.log('Ended', returnArguments);
	    //anything passed into timer.start() will be called back here;
    });
    var  sendObject  = {hello:  'world',this:  'is-me'}
    timer.start(sendObject);
    //if you want to stop a timer once started use the timer.clear() method.
### API

#### Constructor 
`var timer = new waitABit();`

#### Set [milliseconds]
Takes milliseconds as an argument, does not initiate the timer;
`timer.set(milliseconds);`

#### Start [any number of arguments]
Takes any number of arguments and passes it back via the 'expired' event after the milliseconds of SET has expired.

`timer.start([object],[string],[int],[array]);`

#### Clear 
Resets the timer and does not emit the 'expired' event

`timer.clear();`

### Events
#### Start Event
You can listen for the start event if you need to know exactly when the timer started counting down;

    timer.on('start',function(){
	    console.log('timer started')
    });
#### Clear Event
You can listen for the clear event if you need to execute code after a timer has been cleared.

    timer.on('clear',function(){
	    console.log('timer cleared')
    });
  
#### Expired Event
You cal listen for the end event if you need to execute code after a timer has expired.

    timer.on('expired',function(args){
	    console.log('timer expired with arguments returned:',args);
    });

---
_Source: https://npm.io/package/wait-a-bit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
