1.0.0 • Published 1 year ago
@ipainnovation/vue-updater v1.0.0
Updater
A simple plugin for Vue that notifies the user when an update is available and provides an easy way to apply the update.
Prerequisites
- Vue
- Vuetify
- A service worker
Usage
To enable the plugin you have to do two things:
First, a service worker needs to emit a custom event with the name swUpdated
and the current service worker registration as the event detail. Like this:
document.dispatchEvent(new CustomEvent('swUpdated', { detail: registration }));
Secondly, place a <UpdateNotification />
inside the main view, typically in App.vue
.
<template>
<div>
<v-app>
<!-- Rest of the app -->
<UpdateNotication />
</v-app>
</div>
</template>
It is important that the component is added as close to the root of the app as possible. Avoid placing it inside anything that waits for data to load as it might stop the plugin from working.
That's it really.