Negligent Parachute Maintainers

npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

stupid-delay

1.0.0 • Public • Published

Stupid Delay

A stupid RAF controlled delay.

Usage

var Delay = require('stupid-delay');
var Tick = require('stupid-tick');
 
var tick = Tick();
var delay = Delay({
    tick: tick
});
 
delay.add(1000, function(){
    // Do something after 1000ms
});
 

Methods

delay.add(1000, function(){
    // Do something after 1000ms
});
 
// Pause all delays.
delay.pause();
 
// Start all delays (use when paused).
delay.start();
 
// Destroy all delays.
delay.destroy();
 

Pause / Start

delay.add(1000, function(){
    delay.pause();
    setTimeout(function(){
        delay.start();
    }, 2000);
});
 
// Is stoppped by 'delay.pause()'
// and started again by 'delay.start()'.
delay.add(1500, function(){
    // Do something
});
 

Destroy

delay.add(1000, function(){
    delay.destroy();
});
 
// All delays are destroyed and will not run.
delay.add(1500, function(){
    // Does nothing
});
 

Keywords

none

install

npm i stupid-delay

Downloadsweekly downloads

2

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability