fortimer

1.0.8 • Public • Published

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();

Readme

Keywords

Package Sidebar

Install

npm i fortimer

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

6.63 kB

Total Files

8

Last publish

Collaborators

  • requesttimeout