Re: Geofencing alternative proposal

No, activation also only happens once (see SW lifecycle definition
<https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-lifecycle-events>).
The pattern with other APIs (push, fetch, etc) is that event listeners are
registered when you execute the SW JS, i.e. at the top level of the JS
there is this.addEventListener("push", func);

Could you not just do:

this.addEventListener("entergeofence", handleEnter);

On 19 September 2014 23:09, Martin Thomson <martin.thomson@gmail.com> wrote:

> On 19 September 2014 13:44, Marijn Kruisselbrink <mek@google.com> wrote:
> > Your sample code was:
> > this.addEventListener("install", e => {
> >   e.waitUntil(
> > [...]
> > This code gets run once, on installation of the serviceworker.
>
> My bad, I think that I should have used "activate" instead.
>
>

Received on Monday, 22 September 2014 10:23:17 UTC