Skip to content

Latest commit

 

History

History
148 lines (128 loc) · 2.5 KB

README.md

File metadata and controls

148 lines (128 loc) · 2.5 KB

WakeLock

The WakeLock Component will allows you to keep the device screen awake, i.e. prevent the screen from sleeping

Demo

A minimal Demo Link

Usage/Examples

Value Used as a Description
WakeLock ✅ Component Can be used as Component
wakeLock ✅ Service Can be used as Service
1. Here's an example of basic usage with Multiple Import: with Default Import:
// Default import will return WakeLock Component
import WakeLock from 'fe-pilot/WakeLock';

<WakeLock /> // Used as a Component
2. Here's an example of basic usage with Multiple Import: with Multiple Import:
import { WakeLock, wakeLock } from 'fe-pilot/WakeLock';

<WakeLock /> // Used as a Component

wakeLock(); // Used as a Service
3. Here's an example of a advanced usage:
import { WakeLock } from 'fe-pilot/WakeLock';

const successCb = (response) => {
  console.log("success response:", response);
}

const failureCb = (response) => {
  console.log("failure response:", response);
}

wakeLock({ successCb, failureCb });

Props

Props Type Description Response
successCb Function It will be called on success
{
    data: "Can be array/object/string/number",
    msgType: "SUCCESSFUL",
    msg: "A success msg",
    status: "SUCCESS"
}
      
loadingCb Function It will be called before success/failure.
{
  msgType: "LOADING",
  msg: "LOADING...",
  status: "LOADING"
}
failureCb Function It will be called on failure
{
  msgType: "ERROR",
  msg: "A failed msg",
  status: "FAILURE"
}
       
Props Type Description Default Values
showForever Boolean To hide/remove unsupported feature, make it false. Default value is true.