You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 5 години
1234567891011121314151617181920212223
  1. module.exports = function(RED) {
  2. function Invert(config) {
  3. RED.nodes.createNode(this,config);
  4. this.config = config;
  5. var node = this;
  6. var NodeHelper = require('./NodeHelper.js');
  7. var h = new NodeHelper( node );
  8. this.on('input', function(msg) {
  9. var topic = msg.topic;
  10. var payload = msg.payload;
  11. if( topic !== undefined && payload !== undefined ) {
  12. h.SetResult( !h.ToBoolean( payload ), topic );
  13. }
  14. });
  15. h.DisplayUnkownStatus();
  16. }
  17. RED.nodes.registerType("Invert",Invert);
  18. }