18 lines
298 B
JavaScript
18 lines
298 B
JavaScript
|
/*
|
||
|
if we receive a true we toogle output
|
||
|
and store the new state in a local context
|
||
|
with a unique name
|
||
|
*/
|
||
|
var fname = "toggle1";
|
||
|
|
||
|
if(msg.payload === true){
|
||
|
|
||
|
if(context.get(fname) === false){
|
||
|
msg.payload = true;
|
||
|
}else{
|
||
|
msg.payload = false;
|
||
|
}
|
||
|
context.set(fname, msg.payload);
|
||
|
}
|
||
|
return msg;
|