Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nosleep.js

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nosleep.js

Prevent display sleep and enable wake lock in any Android or iOS web browser

  • 0.9.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76K
decreased by-2.3%
Maintainers
1
Weekly downloads
 
Created
Source

NoSleep.js

Prevent display sleep and enable wake lock in all Android and iOS web browsers.

Check out the live demo in any Android or iOS web browser.

Installation

This library is available on Bower as nosleep.

$> bower install nosleep

This package is published to npm as nosleep.js and can be installed with:

$> npm install nosleep.js

Alternatively, you can manually add NoSleep.js to your project (or the minified version).

Build from source

This repository uses webpack to build the distribution versions of the library. To build this library run webpack.

Usage

Create a new NoSleep object and then enable or disable it when needed as follows:

var noSleep = new NoSleep();

function enableNoSleep() {
  noSleep.enable();
  document.removeEventListener('click', enableNoSleep, false);
}

// Enable wake lock.
// (must be wrapped in a user input event handler e.g. a mouse or touch handler)
document.addEventListener('click', enableNoSleep, false);

// ...

// Disable wake lock at some point in the future.
// (does not need to be wrapped in any user input event handler)
noSleep.disable();

License

MIT. Copyright (c) Rich Tibbett

Keywords

FAQs

Package last updated on 04 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc