1.0.8 • Published 6 years ago

ember-online-status v1.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

ember-online-status

Ember addon for checking if Internet connection is up. Makes use of the is-online module, polling to check if the Internet is accessible.

Usage

  • ember install ember-online-status
  • Inject the service in either a controller, route, or component
  • onlineStatus.isCheckingConnection returns true when checking the connection status, false otherwise.
  • onlineStatus.isOnline returns true when the Internet is accessible, false otherwise.

Example:

import Ember from 'ember';

export default Ember.Controller.extend({
  onlineStatus: Ember.inject.service()
});
{{#if onlineStatus.isCheckingConnection}}
  Checking connection...
{{else}}
  {{#if onlineStatus.isOnline}}
    Online
  {{else}}
    Offline
  {{/if}}
{{/if}}

Configuring

Can add a configuration in the environment.js file

ENV.onlineStatus = {
  version: 'v4',
  pollInterval: 15000,
  timeout: 5000
};
pollInterval

Type: number Default: 15000

Milliseconds to wait before checking the connection status again.

timeout

Type: number Default: 5000

Milliseconds to wait for a server to respond.

version

Type: string Values: v4 v6 Default: v4

Internet Protocol version to use. This is an advanced option that is usually not necessary to be set, but it can prove useful to specifically assert IPv6 connectivity.

Installation

  • git clone https://github.com/AdamWard1995/ember-online-status.git
  • cd ember-online-status
  • npm install

Try yourself

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago