Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.
/ xtimer Public archive

Lightweight solution for generator based timers with timeouts and intervals

License

Notifications You must be signed in to change notification settings

viktor-ku/xtimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xtimer

Lightweight solution for timers with timeouts and intervals

Install

npm install xtimer

Get started

This peace of code

const timer = require("xtimer")

timer({
  timeout: 0,
  interval: 1000,
  callback: function(...args) {
    console.log(...args)
  },
  args: [1, "second", { a: 1 }]
})

Will output into the console every second without timeout

1 'second' { a: 1 }

Options

It's the object to pass into timer function

required name type description default
yes callback Function function to execute
no args Array arguments to pass into callback []
no interval Number time in ms between callback calls 100
no timeout Number timeout before first call 0

About

Lightweight solution for generator based timers with timeouts and intervals

Resources

License

Stars

Watchers

Forks

Packages