- From: Jimmy Wärting via GitHub <sysbot+gh@w3.org>
- Date: Mon, 29 May 2023 15:44:03 +0000
- To: public-device-apis-log@w3.org
some nit pick, while reading this code example: ```js let b = await navigator.getBattery(); if (b.energySaverMode) { saveEnergy(); } b.energysavermodechange = () => { if (this.energySaverMode) saveEnergy(); } ``` I could not help but thinking: Hmm is `energySaverMode` a string or not? feels like `energySaverMode` could be either a `"on"` or `"off"` and not a boolean I don't know how i feel about the `r` in `saver` at the end... just using `save` is good enough. I like android / MacOS / iOS naming convention better. - **is**PowerSaveMode - lowPowerMode**Enabled** It's a clear indication that it's a boolean. an alternative name could be `energySaveModeOn` or `shouldPreserveEnergy` or how about using `b.prefersEnergySaving` in javascript as well? i would kind of like it if js & css had similar naming convention. i think i might like `prefersEnergySaving` the most. also this code example: ```diff - b.energysavermodechange = () => { + battery.onenergysavermodechange = () => { if (this.energySaverMode) saveEnergy(); } ``` _Originally posted by @jimmywarting in https://github.com/w3c/battery/issues/56#issuecomment-1567269402_ -- GitHub Notification of comment by jimmywarting Please view or discuss this issue at https://github.com/w3c/battery/issues/9#issuecomment-1567289993 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 29 May 2023 15:44:05 UTC