diff --git a/__app/component/WakeLock/README.md b/__app/component/WakeLock/README.md new file mode 100644 index 0000000..0eb7041 --- /dev/null +++ b/__app/component/WakeLock/README.md @@ -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', + } +}); + +``` \ No newline at end of file diff --git a/__app/component/WakeLock/WakeLock.js b/__app/component/WakeLock/WakeLock.js index 6d81707..d966da8 100644 --- a/__app/component/WakeLock/WakeLock.js +++ b/__app/component/WakeLock/WakeLock.js @@ -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',