1.0.8 • Published 4 years ago

connectionstatus-webcomponent v1.0.8

Weekly downloads
3
License
CC0 1.0 Universal
Repository
github
Last release
4 years ago

Connection Status Web Component

Description

Web component wich helps to detect if the browser has connectivity or not

HOWTO use

Example with plain HTML

See 'demo.html'.

Example with Vue 2

On main.js:

...
import { ConnectionStatus } from 'connectionstatus-webcomponent';
...
Vue.component('connection-status', ConnectionStatus);
...
new Vue({
  render: h => h(App),
}).$mount('#app');

On somecomponent.vue:

Inside <template> section:

...
<connection-status @connection-status-changed="connectionStatusHandler">
</connection-status>
...
<h2>Connection status : {{ onlineStatus }}</h2>
...

Inside <script> section:

...
data() {
  return {
    ...
    onlineStatus: false,
    ...
  };
},
...
methods: {
  ...
  connectionStatusHandler(event) {
    this.onlineStatus = event.detail;
  },
  ...
}
...

Example with Vue 3

On main.js:

...
import { ConnectionStatus } from 'connectionstatus-webcomponent';
...
const app = createApp(App);
...
app.component('connection-status', ConnectionStatus);
...
app.use(...).use(...).mount('#app');

On somecomponent.vue:

Inside <template> section:

...
<connection-status @connection-status-changed="connectionStatusHandler">
</connection-status>
...
<h2>Connection status : {{ onlineStatus }}</h2>
...

Inside <script> section:

...
data() {
  return {
    ...
    onlineStatus: false,
    ...
  };
},
...
methods: {
  ...
  connectionStatusHandler(event) {
    this.onlineStatus = event.detail;
  },
  ...
}
...
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago