filrak / vue-offline

Offline states and storage for Vue PWA
MIT License
349 stars 20 forks source link

global mixin and performance #5

Closed chriscdn closed 5 years ago

chriscdn commented 5 years ago

There is performance problem when registering the mixin as a global. The mounted() hook gets called on each component, which means potentially 100s of calls to window.addEventListener.

window.addEventListener('online',  onlineHandler)
window.addEventListener('offline',  offlineHandler)

Chrome seems to handle this fine. IE, not so well.

filrak commented 5 years ago

@chriscdn this is why you have VueOfflineMixin which you can inject instead of plugin

filrak commented 5 years ago

There will be an huge update next week tho which should eliminate this problem