Skip to content

Instantly share code, notes, and snippets.

@industrialinternet
Last active August 29, 2015 14:02
Show Gist options
  • Save industrialinternet/b932e34a486884419ae9 to your computer and use it in GitHub Desktop.
Save industrialinternet/b932e34a486884419ae9 to your computer and use it in GitHub Desktop.
dumpping ground for freagments
<script type="text/javascript">
RED.nodes.registerType('trigger',{
category: 'function',
color:"#E2D96E",
defaults: {
op1: {value:""},
op2: {value:""},
duration: {value:"250",required:true,validate:RED.validators.number()},
extend: {value:"false"},
units: {value: "ms"},
name: {value:""}
},
inputs:1,
outputs:1,
icon: "trigger.png",
label: function() {
if (this.duration > 0) {
return this.name||"trigger "+this.duration+this.units;
}
else {
return this.name||"trigger once &infin;";
}
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
$( "#node-input-duration" ).spinner({
min:1,
increment:25
});
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment