问题描述
如果workBox-background-sync表中有待处理的请求,我想在Vue中显示通知。 This is my IndexedDB where I store all pending requests.
这是我的service-worker.js文件
const showNotification = () => {
self.registration.showNotification('Sync success!',{
body: 'Queue Resolved '?'',});
};
const bgSyncPlugin = new workBox.backgroundSync.Plugin('offlineData',{
maxRetentionTime: 24 * 60,// Retry for max of 24 Hours (specified in minutes)
callbacks: {
queueDidReplay: showNotification,},});
const networkWithBackgroundSync = new workBox.strategies.NetworkOnly({
plugins: [bgSyncPlugin],});
workBox.routing.registerRoute(/\/*/,networkWithBackgroundSync,'POST');
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)