Socket
Socket
Sign inDemoInstall

@boosten/capacitor-keep-awake

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @boosten/capacitor-keep-awake

Prevent your screen from getting some sleep!


Version published
Weekly downloads
1
Maintainers
1
Install size
1.94 MB
Created
Weekly downloads
 

Readme

Source

capacitor-keep-awake

npm version

Prevent your screen from getting some sleep!

Installation

npm i @boosten/capacitor-keep-awake

Configuration

Example

Check out the example repo: capacitor-keep-awake-example

import { Plugins } from '@capacitor/core';

@Component({
  template: `
    <button (click)="keepAwake()">keep awake!</button>
    <button (click)="allowSleep()">let me sleep!</button>
  `
})
export class SignupComponent {
  async keepAwake() {
    await Plugins.KeepAwake.keepAwake();
  }

  async allowSleep() {
    await Plugins.KeepAwake.allowSleep();
  }
}

Web

This functionality is not applicable to the browser.

iOS

No extra steps required 🙂.

Android

You have to register your plugin in your app main activity. See official Capacitor docs

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {
      {
        // Additional plugins you've installed go here
        // Ex: add(TotallyAwesomePlugin.class);
        add(KeepAwake.class);
      }
    });
  }
}

Credits

Capacitor version of the plugin: cordova insommia.

Keywords

FAQs

Last updated on 04 Dec 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc