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

On Jul 12, 2014 2:11 AM, "Jake Archibald" <jaffathecake@gmail.com> wrote:
>
> On 11 July 2014 17:59, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> On Fri, Jul 11, 2014 at 8:17 AM, Jake Archibald <jaffathecake@gmail.com>
wrote:
>> > navigator.serviceWorker.ready.then(function(reg) {
>> >   reg.push.register(...)
>> > });
>>
>> I agree this looks good. Though maybe
>>
>> reg.registerPush(...)
>>
>> instead?
>
>
> .push also has .unregister, will probably have .hasPermission too.
>

Other Service Worker dependent specs may want to do the same, so each API
having its own namespace seems good. e.g:

// IDL
partial interface ServiceWorkerRegistration {
  readonly attribute TaskScheduler taskScheduler;
}

partial interface ServiceWorkerGlobalScope {
  attribute EventHandler onalarm;
};

// JS
navigator.serviceWorker.ready.then(function(reg) {
  reg.taskScheduler.add(Date.now() + (10 * 60000), ...);
});

> (the current spec has .registrations, but I believe one registration per
serivceworker is the rule now)

Received on Monday, 14 July 2014 02:56:02 UTC