Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const bgSyncPlugin = new workbox.backgroundSync.Plugin('myQueue', {
- callbacks: {
- requestWillEnqueue: (storableRequest) => {}, // I show a push notification indicating user is offline
- requestWillReplay: (storableRequest) => {},
- queueDidReplay: (storableRequestArray) => {} // If I get a response, I show a push notification
- }
- },
- );
- workbox.routing.registerRoute(
- "https://myapi.com/action",
- workbox.strategies.networkOnly({
- plugins: [bgSyncPlugin]
- }),
- 'POST'
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement