db.cloud.usingServiceWorker
Reveals whether a service worker will be responsible of doing the sync requests towards Dexie Cloud Server or if it will be done in the main thread. This will depend on the configuration parameter tryUseServiceWorker and whether the current browser engine is supported to utilize service worker for sync events and whether a service worker was registered by your application.
There are benefits of letting a service worker do the sync requests but it is not required for the addon to work. A service worker can sync in the background, after you app has been closed or the user has put their device in pocket. In some browsers, service workers are also able to periodically sync a few times a day to keep the local database relatively updated also when not using the application.
In order to make a service worker take care of sync, you need to do the following steps:
- Register a service worker for your application.
- Let your service worker import dexie-cloud-addon’s service worker module using
importScripts('dexie-cloud-addon/dist/umd/service-worker.[min].js)')
. - In your db module, configure db.cloud with tryUseServiceWorker
If all of these things are done and you run it in a compatible platform, the db.cloud.usingServiceWorker
should be returning true after the db is open.
Type
boolean
Dexie Cloud Docs
- Access Control in Dexie Cloud
- Add demo users
- Add public data
- Authentication in Dexie Cloud
- Consistency in Dexie Cloud
- DBPermissionSet
- Dexie Cloud API
- Dexie Cloud CLI
- Dexie Cloud Docs
- Dexie Cloud REST API
- DexieCloudOptions
- Invite
- Limits
- Member
- PersistedSyncState
- Purchase Subscription
- Realm
- Role
- Run Dexie Cloud on Own Servers
- Sharding and Scalability
- SyncState
- UserLogin
- db.cloud.configure()
- db.cloud.currentUser
- db.cloud.currentUserId
- db.cloud.events.syncComplete
- db.cloud.invites
- db.cloud.login()
- db.cloud.logout()
- db.cloud.options
- db.cloud.permissions()
- db.cloud.persistedSyncState
- db.cloud.roles
- db.cloud.schema
- db.cloud.sync()
- db.cloud.syncState
- db.cloud.userInteraction
- db.cloud.usingServiceWorker
- db.cloud.version
- db.cloud.webSocketStatus
- db.members
- db.realms
- db.roles
- dexie-cloud-addon