Initial commit

Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com>
Co-Authored-By: Johan  <4934465+joolsus@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
Michael Cartner
2024-01-26 11:52:55 +01:00
commit b9c60b07dc
2789 changed files with 868795 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
'use strict';
const Timer = {
name: 'Timer',
docs: 'https://docs.noodl.net/nodes/utilities/delay',
displayName: 'Delay',
category: 'Utilities',
nodeDoubleClickAction: {
focusPort: 'duration'
},
initialize: function () {
var self = this;
this._internal._animation = this.context.timerScheduler.createTimer({
duration: 0,
onStart: function () {
self.sendSignalOnOutput('timerStarted');
},
onFinish: function () {
self.sendSignalOnOutput('timerFinished');
}
});
this.addDeleteListener(() => {
this._internal._animation.stop();
});
},
getInspectInfo() {
if (this._internal._animation.isRunning()) {
return Math.floor(this._internal._animation.durationLeft() / 10) / 100 + ' seconds';
}
return 'Not running';
},
inputs: {
start: {
displayName: 'Start',
valueChangedToTrue: function () {
if (this._internal._animation._isRunning === false) {
this._internal._animation.start();
}
}
},
restart: {
displayName: 'Restart',
valueChangedToTrue: function () {
this._internal._animation.start();
}
},
duration: {
type: 'number',
displayName: 'Duration',
default: 0,
set: function (value) {
this._internal._animation.duration = value;
}
},
startDelay: {
type: 'number',
displayName: 'Start Delay',
default: 0,
set: function (value) {
this._internal._animation.delay = value;
}
},
stop: {
displayName: 'Stop',
valueChangedToTrue: function () {
this._internal._animation.stop();
}
}
},
outputs: {
timerStarted: {
type: 'signal',
displayName: 'Started'
},
timerFinished: {
type: 'signal',
displayName: 'Finished'
}
}
};
module.exports = {
node: Timer
};