I mean I'm not surprised, it seems like a far fetched method for Javascript just because its so invasive and stopping the user from putting PC to sleep seems more like a malware than anything lol.
In which case I will never be surprised by such a reconsideration seeing how the definition would likely have been canceled once the consequences were determined as impractical for cause (in this case having just a bit
too much potential for abusive interpretation for any real worth, and therefore would've be too big of a risk in actual practice to even proceed with the specification).
As for your
other suggestion, that is not working either which probably means that neither idea was even worth the time
or energy for actual implementation. But thanks for at least trying things for me.
EDIT: I also just noticed that W3C lists the most recent published update as from December 2017 as a recommendation (with everything else listed as draft status) which likely means it hasn't been taken up since (and if such is the case, then it's more than likely that such inaction was the fault of the prospect that further consideration of the risks and other reasons that you mentioned indicates that proceeding with the implementation may not even be worth their efforts in the first place).
EDIT 2: For the avoidance of doubt, this was originally intended to be a more general discussion that evolved into the provision of code (hence the fact that this is actually a better fit in relation to the JavaScript forums).
EDIT 3: The intent to implement hasn't changed either, and this was almost one year ago from this request (December 2018 to be exact). There is also a Mozilla equivalent, but of course it's probably only going to work on Firefox (if at all) and even that is listed as "outside the standardized feature track". Or in other words, this one's done.
See the following references:
https://www.w3.org/TR/wake-lock/
https://www.w3.org/wiki/DAS/Implementations
https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/API/Navigator/requestWakeLock
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy/wake-lock
Request withdrawn, pending moderator action to close subject.