From 3c2e6725fa0a65cee468bb04e647218feca4812b Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Sun, 21 Apr 2024 19:29:01 +0100 Subject: [PATCH] ha: always apply lazy icons to triggers --- apps/ha/ha.lib.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/ha/ha.lib.js b/apps/ha/ha.lib.js index 7b26b02b2..9a48d60eb 100644 --- a/apps/ha/ha.lib.js +++ b/apps/ha/ha.lib.js @@ -40,21 +40,21 @@ exports.getTriggers = function(){ try{ triggers = require("Storage").read("ha.trigger.json"); triggers = JSON.parse(triggers); - - // We lazy load all icons, otherwise, we have to keep - // all the icons n times in memory which can be - // problematic for embedded devices. Therefore, - // we lazy load icons only if needed using the getIcon - // method of each trigger... - triggers.forEach(trigger => { - trigger.getIcon = function(){ - return _getIcon(trigger); - } - }) } catch(e) { // In case there are no user triggers yet, we show the default... } + // We lazy load all icons, otherwise, we have to keep + // all the icons n times in memory which can be + // problematic for embedded devices. Therefore, + // we lazy load icons only if needed using the getIcon + // method of each trigger... + triggers.forEach(trigger => { + trigger.getIcon = function(){ + return _getIcon(trigger); + } + }) + return triggers; } @@ -78,4 +78,4 @@ exports.sendTrigger = function(triggerName){ retries--; } } -} \ No newline at end of file +}