mil-no-sleep
v1.2.1
Published
Wake Lock Webcomponent following open-wc recommendations
Downloads
29
Maintainers
Readme
<mil-no-sleep>
mil-no-sleep mocks the Wake Lock API and extends it to all browsers. This webcomponent follows the open-wc recommendation.
Demo: https://stackblitz.com/edit/mil-no-sleep-example?file=index.js
Installation
npm i mil-no-sleep
Usage
<script type="module">
import 'mil-no-sleep/mil-no-sleep.js';
</script>
<mil-no-sleep></mil-no-sleep>
Methods
disableSleepMode(): Disable Sleep Mode.
enableSleepMode(): Re activate Sleep Mode.
Events
sleepModeDisabled: fired when sleep mode is disabled.
sleepModeEnabled: fired when sleep mode is reactivated.
Linting with ESLint, Prettier, and Types
To scan the project for linting errors, run
npm run lint
You can lint with ESLint and Prettier individually as well
npm run lint:eslint
npm run lint:prettier
To automatically fix many linting errors, run
npm run format
You can format using ESLint and Prettier individually as well
npm run format:eslint
npm run format:prettier
Local Demo with es-dev-server
npm start
To run a local development server that serves the basic demo located in demo/index.html
npm start:compatibility
To run a local development server in compatibility mode for older browsers that serves the basic demo located in demo/index.html