Comments (4)
i can fix iit
from workbox.
OK so i have managed to push though and get workbox set up at its core but now i am to the meat of the issue!
I need to use the backgroud sync function and i have used the example code used in the docs (see below)
My issue now is i get "Queue.js:341 Uncaught TypeError: Cannot use 'in' operator to search for 'sync' in undefined" as an error, am i missing a step?
/* eslint-disable no-undef */
import {precacheAndRoute} from 'workbox-precaching';
import {BackgroundSyncPlugin} from 'workbox-background-sync';
import {registerRoute} from 'workbox-routing';
import {NetworkOnly} from 'workbox-strategies';
const bgSyncPlugin = new BackgroundSyncPlugin('myQueueName', {
maxRetentionTime: 24 * 60, // Retry for max of 24 Hours (specified in minutes)
});
registerRoute(
/\/user/,
new NetworkOnly({
plugins: [bgSyncPlugin],
}),
'POST'
);
precacheAndRoute(self.__WB_MANIFEST || []) /* eslint-disable-line no-restricted-globals */;
// eslint-disable-next-line
self.addEventListener('install', event => event.waitUntil(self.skipWaiting()));
// eslint-disable-next-line
self.addEventListener('activate', event => event.waitUntil(self.clients.claim()));
from workbox.
It very specifically seems to be when creating the Queue its self, the issue seems to be that self.registration doesn't seem to contain the sync prop... i can see it within the registration its self
at the moment i an trying to enforce it running after the registration, which while it prevents a breaking error still isnt working
you can see below how i am enforcing the check
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/service-worker.js').then(registration => {
console.log('SW registered: ', registration);
}).then(() => {
if(navigator.serviceWorker.ready) {
const queue = new Queue('myQueueName');
console.log("queue", queue)
}
})
.catch(registrationError => {
console.log('SW registration failed: ', registrationError);
});
});
}```
from workbox.
Hi there,
Workbox is moving to a new engineering team within Google. As part of this move, we're declaring a partial bug bankruptcy to allow the new team to start fresh. We realize this isn't optimal, but realistically, this is the only way we see it working. For transparency, here're the criteria we applied:
- For PRs, we closed everything that doesn't target the current
v7
branch. - For Issues, we closed everything that was created before 2024.
Thanks, and we hope for your understanding!
The Workbox team
from workbox.
Related Issues (20)
- non-precached-url :: [{"url":"/"}]
- Long queue time on the initial index.html request during SW update with heavy precache HOT 1
- typo
- new method for custom plugins called "" HOT 2
- new "cachedResponseIsAbsent" method for custom plugins
- Is this project not maintained anymore? HOT 3
- Please Sign the Open Letter to Tim Cook: Sabotaging Web Apps Is Indefensible HOT 2
- [email protected] is deprecated HOT 2
- Google fonts sometimes fail to load - caching of opaque errors
- Split code for the Workbox library when using the `InjectManifest` class
- I cannot see the workbox pre-cached database in the Safari browser HOT 1
- CacheableResponse should accept an array of header values
- Precaching doesn't work properly in Safari when offline
- Consider adding `maxUnusedSeconds` and `updateStale` to `ExpirationPlugin` config
- Standardize behavior of `maxAgeSeconds`
- Update Node version on Glitch demos
- Support wasm files by default in globPatterns
- CVE-2021-23337 Command Injection in lodash
- [docs] Wrong menu label for page "Retrying requests when back online"
- Minimum rollup version isn't high enough for @rollup/plugin-node-resolve
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workbox.