nuxt-community / pwa-template

PWA template for vue-cli based on the starter template
MIT License
133 stars 12 forks source link

Use external function for event listeners #1

Closed samtgarson closed 7 years ago

samtgarson commented 7 years ago

According to W3:

To remove event handlers, the function specified with the addEventListener() method must be an external function.

Anonymous functions will not work.

window.addEventListener returns nothing (making this._offline_listener == undefined), so making this change to use an existing, external function which we can refer to later when destroying the component.

I think this works better...

atinux commented 7 years ago

@pi0 ready to merge?