ha: always apply lazy icons to triggers

pull/3375/head
Rob Pilling 2024-04-21 19:29:01 +01:00
parent 0a097dd031
commit 3c2e6725fa
1 changed files with 12 additions and 12 deletions

View File

@ -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--;
}
}
}
}