linuxha / node-red-contrib-mytimeout

A dynamic count down timer for node-red
MIT License
10 stars 10 forks source link

Tick interval #29

Open tvlada73 opened 4 years ago

tvlada73 commented 4 years ago

I think it would be great if we can setup tick interval value in node settings?

linuxha commented 4 years ago

I understand what you are asking for but I'm not sure how to implement this. Currently I've set one second. What interval are you looking for.

tvlada73 commented 4 years ago

So nothing spectacular! Instead of writing 1000 to trigger every 1 sec, set one variable that we could change. In my case It would be great to put 60s or in milis, so without much workload I am improving the time remaining, and since my processes are long, seconds mean nothing.

GUI variable triggerInterval should be added

    // Once the node is instantiated this keeps running
    // I'd like to change this to run when only needed

    var tick = setInterval(function() {
        var msg = { payload:'TIX', topic:""};
        node.emit("TIX", msg);
    }, **_triggerInterval_**);          // trigger interval added

I can fork it?

linuxha commented 4 years ago

You can fork it but there's an issue, there are other dependencies on those ticks. It's expected that the ticks are 1 second and whole numbers. That will take some changes to the code to make work properly. I rejected doing that in the past because I didn't have the time to re-engineer the whole thing. I think that still may be the case though I have refactored the code.

tvlada73 commented 4 years ago

Ok, i'll go through the whole code, I just ran over it...