Skip to content

Commit

Permalink
Merge pull request #23 from Alok30/feature_wakelock
Browse files Browse the repository at this point in the history
docs: documention for wakelock
  • Loading branch information
opensrc0 authored Apr 10, 2024
2 parents e2e5c5c + 7fc901b commit 54a230b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions __app/component/WakeLock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## WakeLock Service Documentation

The WakeLock service provides functionality to manage WakeLock for preventing the screen from sleeping.

## Usage

### 1. Apply WakeLock

```js
import WakeLockService from 'path/to/WakeLockService';

// Apply WakeLock
WakeLockService();
```

## 2. Success: successCb callBack Fn along with success msg

```js
const successCb = ({ msgType, msg, data }) => {
console.log(msgType); // Success
console.log(msg); // WakeLock successfully applied!
}

WakeLockService({ successCb });
```
> [!Note]
> **successCb** will get an object contains the property ```msgType```, ```msg```, ```data```
## 3. Failure: failureCb callBack Fn along with failure msg
```js
const failureCb = ({ msgType, msg }) => {
console.log(msgType); // UN_SUPPORTED_FEATURE or ERROR
console.log(msg); // Corresponding error message
}

WakeLockService({ failureCb });

```

## 4. Combine with Callbacks and Messages

```js
WakeLockService({
successCb,
successMsg: "WakeLock successfully applied!",
failureCb,
failureMsg: {
unSupported: 'Your browser does not support the WakeLock feature',
error: 'Unable to apply WakeLock',
}
});

```
2 changes: 1 addition & 1 deletion __app/component/WakeLock/WakeLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ WakeLock.propTypes = {
WakeLock.defaultProps = {
successCb: () => { },
failureCb: () => { },
successMsg: 'WakeLock successfully!!',
successMsg: 'WakeLock successfully applied!',
failureMsg: {
unSupported: 'Your browser does not support the WakeLock fetaure',
error: 'Unable to apply WakeLock',
Expand Down

0 comments on commit 54a230b

Please sign in to comment.