W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2014

[push-api] Moving "PushManager push" onto ServiceWorkerRegistration

From: Jake Archibald <jaffathecake@gmail.com>
Date: Fri, 11 Jul 2014 16:17:12 +0100
Message-ID: <CAJ5xic9n6BXA0LFRA=UnCShgaj34kPwpy86BP=UWKkKqT6UpJg@mail.gmail.com>
To: Webapps WG <public-webapps@w3.org>
Currently serviceworker-dependent APIs are sitting in navigator.whatever,
but now we're adding a ServiceWorkerRegistration object (
https://github.com/slightlyoff/ServiceWorker/issues/365#issue-37477775) it
feels like they should live there.

So instead of:

navigator.serviceWorker.ready.then(function() {
  navigator.push.register(...)
});

it'd be:

navigator.serviceWorker.ready.then(function(reg) {
  reg.push.register(...)
});

This should make it clearer that push registrations are dependent on the
serviceworker registration. Meaning each serviceworker can have its own
push registration, and unregistering a serviceworker means the push is
unregistered with it.

We're also discussing introducing
navigator.serviceWorker.getRegistration(docURL), allowing developers to get
any serviceworker registration on the origin. This means a page like
"/config/" could register/unregister push for other parts of the origins
("/calendar/", "/messaging/" etc).

Does that sound reasonable?
Received on Friday, 11 July 2014 15:17:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:26 UTC