@deveodk/vue-online
v1.0.2
Published
An easy way to show if a users browser is online, with support for custom notification drivers. Inspired by Sopamo/vue-online.
Downloads
143
Maintainers
Readme
@deveodk/vueOnline
An easy way to show if a users browser is online, with support for custom notification drivers. Inspired by Sopamo/vue-online.
Demo
See a functioning demo deveo demo site
Installation
npm install --save @deveodk/vue-online
Bundler (Webpack, Rollup)
import Vue from 'vue'
import vueOnline from '@deveodk/vue-online'
Vue.use(vueOnline)
Browser
<!-- From CDN -->
<script src="https://unpkg.com/@deveodk/vue-online"></script>
Usage
The package provides multiple options to notfiy if a users browser is online. The easiest way is to let the plugin do it automaticly.
Using @deveodk/vue-toastr driver
# Using the default notification
import online from '@deveodk/vue-online'
Vue.use(online, {
notifier: require('@deveodk/vue-online/drivers/deveoToastr.js'),
defaultOnlineTitle: 'Online',
defaultOnlineMessage: 'You are online',
defaultOfflineTitle: 'Offline',
defaultOffilneMessage: 'You are offline'
})
Extending the functionality on your own
# The plugin comes with a build in mixin that allows you to make your own functionality
import {VueOnline} from '@deveodk/vue-online'
export default {
mixins: [VueOnline]
}
This will give you a reactive variable {{VueOnline}}
the variable is either true
for online, or false
for offline