Sunday 16 April 2017

Change Timer Callback Function NodeJS

Is it possible to change the callback function of a running timer? I want to update what the callback function is for the timer without reseting the time.

Given:

let timerExample = timers.setInterval(function() { console.log("setTimeout: It's been one second!"); }, 10000);

Possible:

timerExample.callBack = function() { console.log('some new callback') };



via Bryce

No comments:

Post a Comment