grp.listen init, value - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: grp.listen init, value (/showthread.php?tid=2328) |
grp.listen init, value - buuuudzik - 06.11.2019 I've found that grp.listen() when when it has last optional param set to true, then it initially runs 2 times: 1) state=="init", 2) state=="value" I think state=="value" should only run when value change or update on a bus, this is logically separated from "init". RE: grp.listen init, value - admin - 08.11.2019 This is intended behavior. You can ignore init state and/or use a variable to check if this is the first time that callback is called. RE: grp.listen init, value - DGrandes - 09.12.2020 Hi! Is there any way to use grp.listen() when an object updates but not changes? I´m doing a emergent notification and many times the message is the same. Object updates but function inside JS doesn´t run. Code: grp.listen("33/1/255", function(object,state) { RE: grp.listen init, value - admin - 09.12.2020 Add a third argument (true) to grp.listen to catch all messages. You also need to clear the timeout on each value update otherwise your function won't work correctly. Code: $(function() { RE: grp.listen init, value - DGrandes - 09.12.2020 (09.12.2020, 09:28)admin Wrote: Add a third argument (true) to grp.listen to catch all messages. You also need to clear the timeout on each value update otherwise your function won't work correctly. Ok Thanks! |