When reading the specs for various JavaScript APIs, you might come across the requirement that the document be "fully active" before you can use them. Here's a definition of what that means from the specs: https://html.spec.whatwg.org/multipage/browsers.html#fully-active
What remains unclear is how to know if the document is fully active or not. As an example, the WakeLock API requires the document to be fully active. If the document is not fully active, then calling "WakeLock.request()" will reject the returned promise with a "NotAllowedError" error object. However, there are other reasons it might return a "NotAllowedError" and does not specify which reason in a given case.
So, how can I proactively determine if a document is fully active before attempting to use APIs that require it?