1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Tidy-up inject node once-timer on close

This commit is contained in:
Nick O'Leary 2018-01-13 21:17:14 +00:00
parent fd9e3fc03a
commit 41582045d0
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -49,7 +49,7 @@ module.exports = function(RED) {
};
if (this.once) {
setTimeout( function() {
this.onceTimeout = setTimeout( function() {
node.emit("input",{});
node.repeaterSetup();
}, this.onceDelay);
@ -80,6 +80,9 @@ module.exports = function(RED) {
RED.nodes.registerType("inject",InjectNode);
InjectNode.prototype.close = function() {
if (this.onceTimeout) {
clearTimeout(this.onceTimeout);
}
if (this.interval_id != null) {
clearInterval(this.interval_id);
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }