On Thu, May 1, 2014 at 5:26 PM, Martin Thomson <martin.thomson@gmail.com> wrote: > On 1 May 2014 16:55, Jonas Sicking <jonas@sicking.cc> wrote: >> function registrationHandler() { >> navigator.push.register().then((endpoint) => { >> sendBackToAppServer(endpoint); >> navigator.push.registrationNeeded.then(registrationHandler); >> } >> } >> navigator.push.registrationNeeded.then(registrationHandler); > > 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. / JonasReceived on Friday, 2 May 2014 00:32:49 UTC
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:24 UTC