Giter VIP home page Giter VIP logo

Comments (6)

linuxha avatar linuxha commented on September 28, 2024

I hadn't considered a pause. At the moment I'm not sure if it could be added (because I haven't had a chance to give it some thought).

If the feature is added, the "pause" command would be used, not sure how to restart it yet (yes restart might seem obvious). I'll need to give it some thought. The Stop and Cancel have a separate use and will remain as is.

What would the output be for output one? It currently sends "on", "off" (or the appropriate safe/unsafe string) and stop. Cancel is not seen on output one, Also what to send on output 2?

To work around this for now, I can recommend grabbing the output from output 2

from node-red-contrib-mytimeout.

readeral avatar readeral commented on September 28, 2024

I'll see what I can put together in a pull request for you

from node-red-contrib-mytimeout.

readeral avatar readeral commented on September 28, 2024

I've opened a pull request. Hasn't had any problems for me.

I have had to make a structural change however. Rather than having a constant running setInterval, it's now started and stopped on the on() and off() (and pause()) functions - otherwise the timer would continue to count down despite the pause. This is because the TIX event listener function contained the logic for decrementing the timer (ticks), and Stop() influenced this logic by setting ticks to 0.

Although TIX still contains that logic, whether a payload is sent is now first determined by whether there is an active tick Interval or not (and so whether the TIX event is triggered in the first place).

Given this change there's probably an opportunity for simplifying the code somewhat, but I've left that alone.

Major release?
I wouldn't necessarily consider this a breaking change, given that the input and output messages remain the same, aside from the extending of possible values, but anyone who was somehow relying on that constant Interval (not sure how given it's not exposed) may have concerns.

I would however consider this a breaking change in one area, and that is in initialising the timer. In the current iteration there is (I think... I can't recall now) a one second delay before the timer actually decrements, which has now been changed, as on calling startInterval() an initial event TIX is emitted before the Interval starts. For anyone who has timers specific enough to have programmed in compensation for this, it would be a breaking change.

from node-red-contrib-mytimeout.

linuxha avatar linuxha commented on September 28, 2024

readeral, I'll try to get this into a new feature branch. So sorry that I've ignored this (yes over a year). Real life intruded.

from node-red-contrib-mytimeout.

readeral avatar readeral commented on September 28, 2024

from node-red-contrib-mytimeout.

linuxha avatar linuxha commented on September 28, 2024

I'm still working on this, I've decided it will be pause/continue as that seems to make the most sense. I'm still working on tests for this. Also I'm working on a few defects I've found. I'm rewriting the tests (and actually writing the requirements.). While rewriting the tests I found a few bugs.

from node-red-contrib-mytimeout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.