Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

every-moment

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

every-moment

Declarative setinterval using moment durations

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

NPM version Build Status Dependency Status

Declarative setInterval using moment durations

Getting Started

See usage for example of combining the 'wait-one-moment' module for declarative setTimeout and setInterval.

Install

$ npm install --save every-moment

Usage

var every = require('every-moment');
var wait = require('wait-one-moment');
var potatoes;

var timer = every(1, 'second', function() {
    console.log(this.duration);
});

wait(5, 'seconds', function() {
    timer.set(2, 'seconds').start();
});

wait(10, 'seconds', function() {
    console.log('Stop the clock!');
    timer.stop();
});

wait(15, 'seconds', function() {
    if(!potatoes) {
        console.log('No potatoes :(');
        potatoes = true;
        this.start();
    } else {
        console.log('YUM :)');
    }
});

License

MIT © Ray Gerrard

Keywords

every-moment

FAQs

Package last updated on 11 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts