@gamalielmh921230/node_timer

1.0.13 • Public • Published

node_timer

Clase para crear timers que se ejecuten indefinidamente

Apoyar el proyecto

alt text

Para Instalar

npm i @gamalielmh921230/node_timer 
//o
yarn add @gamalielmh921230/node_timer

Como se Usa

    const Timer = require('@gamalielmh921230/node_timer')

    const Reloj= new Timer(1000,()=>{ 
        
        const horas = (new Date()).getHours();
        const minutos = (new Date()).getMinutes();
        const segundos = (new Date()).getSeconds();

        console.log(`${horas}:${minutos}:${segundos}`)
    })

    //se arranca el timer
    Reloj.start()

Definicion de la clase

Metodos

  • start(): Arranca la ejecucion del timer
  • stop(): Detiene la ejecucion del timer
  • setCallback(): Establece la funcion que se ejecutara en cada ciclo
  • setInterval(): Establece el intervalo de tiempo que tardara en ejecutar un ciclo
  • isrunning(): true si el timer esta activo

Package Sidebar

Install

npm i @gamalielmh921230/node_timer

Weekly Downloads

19

Version

1.0.13

License

MIT

Unpacked Size

2.58 kB

Total Files

4

Last publish

Collaborators

  • gamalielmh921230