From eee2b4b6c0e03a48cd117584e35810245cc906da Mon Sep 17 00:00:00 2001 From: Olivier <16240457+TiTidom-RC@users.noreply.github.com> Date: Fri, 9 Jan 2026 22:52:32 +0100 Subject: [PATCH] Dispatch events with both CustomEvent and jQuery Events are now dispatched using both the native CustomEvent API and jQuery's trigger for backward compatibility. This ensures that all listeners, regardless of implementation, receive the events. --- core/js/jeedom.class.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/core/js/jeedom.class.js b/core/js/jeedom.class.js index d8b6e26014..5f7a1db256 100644 --- a/core/js/jeedom.class.js +++ b/core/js/jeedom.class.js @@ -81,15 +81,12 @@ jeedom.changes = function() { object_summary_update.push(data.result[i].option) continue } + + // Dispatch à la fois en natif (dispatchEvent) et jQuery (rétrocompatibilité) if (isset(data.result[i].option)) { - if (['scenario::update', 'ui::update', 'jeedom::gotoplan', 'jeedom::alert', 'jeedom::alertPopup', 'jeedom::coloredIcons', 'message::refreshMessageNumber', 'update::refreshUpdateNumber', 'notify', 'checkThemechange', 'changeTheme'].includes(data.result[i].name)) { - document.body.dispatchEvent(new CustomEvent(data.result[i].name, { detail: data.result[i].option })) - } else { - if (typeof jQuery === 'function') { - $('body').trigger(data.result[i].name, data.result[i].option) - } else { - document.body.dispatchEvent(new CustomEvent(data.result[i].name, { detail: data.result[i].option })) - } + document.body.dispatchEvent(new CustomEvent(data.result[i].name, { detail: data.result[i].option })) + if (typeof jQuery === 'function') { + $('body').trigger(data.result[i].name, data.result[i].option) } } else { document.body.dispatchEvent(new CustomEvent(data.result[i].name))