npm

Don't miss out on this year's npm Pride t-shirt designs!Order your favorites here »

timers-obj

1.0.0 • Public • Published

timers-obj

Build Status Coverage Status npm

This module provides the wrappers for standard timers module so all timers (immediate, interval and timeout) can be used as objects.

For constructors, callback argument is after delay argument so it provides more convenient syntax for CoffeeScript and LiveScript, ie.:

timer = timers.interval 1000->
  console.log 'Time is ticking'

Requirements

This module requires Node >= 6.

Installation

npm install timers-obj

Additionally for Typescript:

npm install -D @types/node

Usage

const timers = require("timers-obj")

Typescript:

import * as timers from "timers-obj"

or:

import {Immediate, immediate, Interval, interval, Timeout, timeout} from "timers-obj"

immediate

Create timer

const timer = timers.immediate(cb, [...args])

Remove timer

timer.remove()

interval

Create timer

const timer = timers.interval(delay, cb, [...args])

Remove timer

timer.remove()

timeout

Create timer

const timer = timers.timeout(delay, cb, [...args])

Remove timer

timer.remove()

License

Copyright (c) 2016-2019 Piotr Roszatycki piotr.roszatycki@gmail.com

MIT

install

npm i timers-obj

Downloadsweekly downloads

31

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability