W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2014

Re: Progress on Push API

From: Martin Thomson <martin.thomson@gmail.com>
Date: Thu, 1 May 2014 22:18:14 -0700
Message-ID: <CABkgnnXttZ-23p6YLthO5Vmw_ENmcZtnq-BpxATBu-xo3dx=Qg@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: EDUARDO FULLEA CARRERA <efc@tid.es>, Domenic Denicola <domenic@domenicdenicola.com>, public-webapps <public-webapps@w3.org>
On 1 May 2014 17:31, Jonas Sicking <jonas@sicking.cc> wrote:
>> If it's going to happen over and over, why not an event?
>> function register() {
>>   navigator.push.register().then(endpoint => sendToAppServer(endpoint));
>> }
>> navigator.push.onderegister = e => register;
> For two reasons:
> * If the page does some initialization asynchronously then it might
> miss that the "deregister" event fires. I.e. it is very easy to
> accidentally register the onderegister event handler "too late".
> * It would require that we for each page that the user visits check if
> that page has a registration, and if that registration has been lost
> by the server. We only want to do this on pages that care about push
> registration and is actually going to make a registration if needed.
> Not for every page the user visits.

Fair points, but with a an event coupled to a state (attribute boolean
registered), this can be avoided.  I guess that the point of your
second proposal at least is that it sort of rolls all that into the
one package.

I think that I prefer the "registration needed callback" approach,
even though it seems to be a little surprising in the sense that it
shares many characteristics with events.  Maybe a onregistrationneeded
event would be a closer fit.
Received on Friday, 2 May 2014 05:18:42 UTC

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