Comments (6)
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.
I'll see what I can put together in a pull request for you
from node-red-contrib-mytimeout.
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.
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.
from node-red-contrib-mytimeout.
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)
- Timer does not stop for FLOAT timeout values HOT 3
- "TypeError: node.warn is not a function" HOT 4
- Time remaining (Output 2) is not in msg.payload HOT 1
- L495: newMsg(inMsg): RangeError: Maximum call stack size exceeded HOT 13
- Output Topic - not coming out HOT 5
- First countdown msg is a string ! HOT 7
- Run different instances of timer based on msg.topic HOT 3
- Should I pass in a JSON string or a javascript object? HOT 9
- Feature Request: Allow the Timer On Payload HOT 1
- Feature Request: Allow the "Timer On Payload" to work like the "Warning state payload" HOT 3
- A msg.warning of 0 doesn't override the GUI setting to cancel sending a warning message HOT 3
- Warning output doesn't contain extra attributes like the on and off messages do.
- Warning sent when setting countdown to low value eg. `3` and warning param to 0 in GUI HOT 4
- Topic Using Mustache HOT 10
- Add topic to 2nd output HOT 5
- Tick interval HOT 4
- strange behaviour, does not turn off , or even turns on instead HOT 3
- unwanted starting of countdown HOT 6
- The workspace contains some nodes that are not properly configured ... HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-mytimeout.