This commit is contained in:
Thomas Lovén 2020-10-28 20:39:25 +01:00
parent f30ad17fe3
commit a384b48331
2 changed files with 4 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ export const BrowserModBrowserMixin = (C) => class extends C {
} }
sensor_update() { sensor_update() {
window.queueMicrotask( async () => { const update = async () => {
const battery = navigator.getBattery ? await navigator.getBattery() : undefined; const battery = navigator.getBattery ? await navigator.getBattery() : undefined;
this.sendUpdate({browser: { this.sendUpdate({browser: {
path: window.location.pathname, path: window.location.pathname,
@ -24,7 +24,8 @@ export const BrowserModBrowserMixin = (C) => class extends C {
battery_level: this.isFully ? window.fully.getBatteryLevel() : battery ? battery.level*100 : undefined, battery_level: this.isFully ? window.fully.getBatteryLevel() : battery ? battery.level*100 : undefined,
charging: this.isFully ? window.fully.isPlugged() : battery ? battery.charging : undefined, charging: this.isFully ? window.fully.isPlugged() : battery ? battery.charging : undefined,
}}); }});
}); };
update();
} }
do_navigate(path) { do_navigate(path) {