Translations:Rule Examples/45/en

Материал из Wiren Board
Версия от 20:37, 21 сентября 2022; Matveevrj (обсуждение | вклад) (Новая страница: «<syntaxhighlight lang="ecmascript"> function makeMotionDetector(name, timeout_ms, detector_control, relay_control) { var motion_timer_id = null; defineRule(name, { whenChanged: "wb-gpio/" + detector_control, then: function(newValue, devName, cellName) { if (!newValue) { dev["wb-gpio"][relay_control] = true; if (motion_timer_id) { clearTimeout(motion_timer_id); }»)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)

<syntaxhighlight lang="ecmascript">

function makeMotionDetector(name, timeout_ms, detector_control, relay_control) {
 var motion_timer_id = null;
 defineRule(name, {
     whenChanged: "wb-gpio/" + detector_control,
     then: function(newValue, devName, cellName) {
         if (!newValue) {
             dev["wb-gpio"][relay_control] = true;
             if (motion_timer_id) {
                 clearTimeout(motion_timer_id);
             }