Global

Members

isEnabled

Checks if NoSleepApp is enabled.
Source:

(constant) isOldIOS

Determines if the current device is running an older version of iOS (pre-iOS 10). This is useful for applying platform-specific workarounds for older iOS devices.
Source:

Methods

disable()

Disables NoSleepApp functionality. Stops Wake Lock, iOS hack, or video playback depending on the platform.
Source:

(async) enable() → {Promise.<void>}

Enables the NoSleepApp functionality. Uses the Wake Lock API, older iOS hack, or video playback as appropriate.
Source:
Throws:
Throws an error if enabling fails.
Type
Error
Returns:
Resolves when enabling is complete.
Type
Promise.<void>

handleFullscreenChange()

Handles the `fullscreenchange` event. Invokes the callback if the document enters fullscreen mode.
Source:

handleVisibilityChange()

Handles the `visibilitychange` event. Invokes the callback if the document is visible.
Source:

isNativeWakeLockSupported() → {boolean}

Determines if the native Wake Lock API is supported.
Source:
Returns:
True if Wake Lock API is supported.
Type
boolean

pause()

Pauses the video, stopping its effect of preventing sleep.
Source:

play() → {Promise.<void>}

Plays the video to keep the device awake.
Source:
Returns:
Resolves when playback successfully starts.
Type
Promise.<void>

removeListeners()

Removes the event listeners for visibility and fullscreen changes.
Source:

setMetadataListener()

Sets up a listener for the `loadedmetadata` event on the video element. This ensures the video behaves correctly based on its duration.
Source: