feat: Setting background synchronization (#3331)
* Changing the background synchronization setting * add example * return function * style: add clarification note --------- Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com> Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
This commit is contained in:
parent
cefc403791
commit
c0ba5e545b
1 changed files with 33 additions and 3 deletions
|
|
@ -1721,6 +1721,23 @@ class Client extends EventEmitter {
|
|||
}, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting background synchronization.
|
||||
* NOTE: this action will take effect after you restart the client.
|
||||
* @param {boolean} flag true/false
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async setBackgroundSync(flag) {
|
||||
return await this.pupPage.evaluate(async flag => {
|
||||
const backSync = window.Store.Settings.getGlobalOfflineNotifications();
|
||||
if (backSync === flag) {
|
||||
return flag;
|
||||
}
|
||||
await window.Store.Settings.setGlobalOfflineNotifications(flag);
|
||||
return flag;
|
||||
}, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user device count by ID
|
||||
* Each WaWeb Connection counts as one device, and the phone (if exists) counts as one
|
||||
|
|
|
|||
Loading…
Reference in a new issue