diff -r 8e5d383a58cb -r c80a5a7198ea svghmi/svghmi.js --- a/svghmi/svghmi.js Thu Feb 18 12:02:28 2021 +0100 +++ b/svghmi/svghmi.js Fri Feb 19 10:03:00 2021 +0100 @@ -51,12 +51,10 @@ // Apply updates recieved through ws.onmessage to subscribed widgets function apply_updates() { - for(let index in updates){ - // serving as a key, index becomes a string - // -> pass Number(index) instead - dispatch_value(Number(index), updates[index]); - delete updates[index]; - } + updates.forEach((value, index) => { + dispatch_value(index, value); + }); + updates.clear(); } // Called on requestAnimationFrame, modifies DOM @@ -110,7 +108,7 @@ if(iectype != undefined){ let dvgetter = dvgetters[iectype]; let [value, bytesize] = dvgetter(dv,i); - updates[index] = value; + updates.set(index, value); i += bytesize; } else { throw new Error("Unknown index "+index); @@ -292,7 +290,7 @@ function send_hmi_value(index, value) { if(index > last_remote_index){ - updates[index] = value; + updates.set(index, value); if(persistent_indexes.has(index)){ let varname = persistent_indexes.get(index);