kulkarnivinayak / v-offline

:electric_plug: Simple VueJS component to detect offline & online changes.

Home Page:https://vinayakkulkarni.github.io/offline/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

V-Offline ⚑

  • Detect offline & online events for your vue app.

  • This is on GitHub so let me know if I've b0rked it somewhere, give me a star :star: if you like it :beers:

  • Demo here -> πŸ’― Webpackbin Link

Requirements

:white_check_mark: Install :ok_hand:

npm install v-offline
// or
yarn add v-offline

:white_check_mark: Usage :mortar_board:

Register the component globally:

Vue.component('offline', require('v-offline'));

Or use locally

import offline from 'v-offline';

:white_check_mark: Example :four_leaf_clover:

<offline v-on:detected-condition="detected">
	<div slot="online">
		Your Online Content!
	</div>
	<div slot="offline">
		Your Offline Content!
	</div>
</offline>
Vue.component('example-component', {
	data() {
		return {
			state: null,
		}
	},
	methods: {
		detected(e) {
			this.state = e;
		}
	}
});

βœ… πŸ“– Props

Name Type Default Required? Description
onlineClass String ui success message No Styling the div which you want to give if you're online.
offlineClass String ui error message No Styling the div which you want to give if you're offline.

βœ… πŸ‘‚ Events

Name Description
detected-condition Emits an Boolean value which can be used for multiple purposes in your app.

NPM :octocat:

NPM

About

:electric_plug: Simple VueJS component to detect offline & online changes.

https://vinayakkulkarni.github.io/offline/

License:MIT License


Languages

Language:JavaScript 100.0%