Skip to content

z41z/fortimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fortimer

Manage your JavaScript timer.

Install

  npm i fortimer //or yarn add fortimer

Usage

  import Timer from 'fortimer'
  let timer = new Timer()
  timer.add({
    name: 'test',
    repeat: true,
    func: () => {
      console.log(new Date())
    }
  })
  • add(obj = {})

    • {Object} config
      • {String} name: timer name
      • {Boolean} repeat: default false,true for setInterval(),false for setTimeout()
      • {Number} duration: timer duraion,default 1000ms
      timer.add({
        name: 'test',
        repeat: true,
        duration: 10e3,
        func: ()=>{
          console.log(new Date())
        }
      });
      // return timer
  • getAll()

      timer.getAll();
  • remove(name)

    • {String} name: timer name
      timer.remove('test');
  • removeAll()

      timer.removeAll();

Releases

No releases published

Packages

No packages published