Trigger node not handling a duration of 0 as block mode

Fixes #1316
This commit is contained in:
Nick O'Leary
2017-07-03 15:17:17 +01:00
parent 360b0d9997
commit d8a3d2793f
3 changed files with 28 additions and 19 deletions

View File

@@ -172,8 +172,7 @@
}
else if ((this.duration * 1) < 0) {
$("#node-then-type").val("loop");
this.duration = this.duration * -1;
$("#node-input-duration").val(this.duration);
$("#node-input-duration").val(this.duration*-1);
} else {
$("#node-then-type").val("wait");
}
@@ -194,6 +193,7 @@
$("#node-input-duration").val($("#node-input-duration").val() * -1);
}
}
});
</script>

View File

@@ -47,7 +47,10 @@ module.exports = function(RED) {
this.extend = n.extend || "false";
this.units = n.units || "ms";
this.reset = n.reset || '';
this.duration = n.duration || 250;
this.duration = parseInt(n.duration);
if (isNaN(this.duration)) {
this.duration = 250;
}
if (this.duration < 0) {
this.loop = true;
this.duration = this.duration * -1;