Run subscribe only when serviceWorker.ready resolves
The register promise may resolve even when the serviceWorker is not ready, this makes sure it is ready to setup a subscription.
This commit is contained in:
Родитель
ce00ab33d6
Коммит
c34769a9fa
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Register a Service Worker.
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
navigator.serviceWorker.register('service-worker.js');
|
||||
|
||||
navigator.serviceWorker.ready
|
||||
.then(function(registration) {
|
||||
// Use the PushManager to get the user's subscription to the push service.
|
||||
return registration.pushManager.getSubscription()
|
||||
|
|
Загрузка…
Ссылка в новой задаче