UNPKG

node-red-contrib-self-healing

Version:
101 lines (98 loc) 2.98 kB
<script type="text/javascript"> RED.nodes.registerType("debounce", { category: "SHEN", defaults: { name: { value: "" }, delay: { value: "2", required: true }, delayInterval: { value: "0", required: false }, strategy: { value: "last", required: false }, }, icon: "status.png", color: "#74b9ff", inputs: 1, outputs: 2, align: "left", inputLabels: "JSONArray", outputLabels: ["execute", "delayed"], label: function () { return this.name || "debounce"; }, }); </script> <script type="text/html" data-template-name="debounce"> <div class="form-row"> <label for="node-input-name" style="width:80%;"> <i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span> </label> <input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name" /> </div> <div class="form-row"> <label for="node-input-delay" style="width:80%;"> <i class="fa fa-tag"></i> Minimum delay between messages/actions (s) </label> <input type="number" id="node-input-delay" min="0" placeholder="2" /> </div> <div class="form-row"> <label for="node-input-delayInterval" style="width:80%;"> <i class="fa fa-tag"></i> Time delay interval (ms) </label> <input type="number" id="node-input-delayInterval" step="1" min="0" placeholder="0" /> </div> <div class="form-row"> <label for="node-input-strategy" style="width:80%;" ><i class="fa fa-tag"></i> Compensate strategy </label> <select type="text" id="node-input-strategy"> <option>first</option> <option>last</option> <option>allByOrder</option> <option>discard</option> </select> </div> </script> <script type="text/html" data-help-name="debounce"> <p>A node to delay messages in order to avoid overload</p> <h3>Details</h3> <p> This node can be used to delay a command (message) in order to meet the actuator response capacity. </p> <h3>The following strategies can be applied:</h3> <dl class="message-properties"> <dt>discard</dt> <dd>discards the delayed message</dd> <dt>first</dt> <dd>sends the first delayed message</dd> <dt>last</dt> <dd>sends the last delayed message</dd> <dt>allByOrder</dt> <dd>sends all delayed messages</dd> </dl> <h3>Inputs</h3> <dl class="message-properties"> <p>Any type of message</p> <p> <b>Note</b>: If the input message has an cancel field, the current debounce state is reset (clear all messages and reset all timers), considering the input message as the first message. </p> </dl> <h3>Outputs</h3> <dl class="message-properties"> <dt>Execute</dt> <dd>Messages that are being sent within the allowed response capacity</dd> <dt>Delayed</dt> <dd>Messages that are overloading the response capacity</dd> </dl> </script>