Code Monkey home page Code Monkey logo

ember-online-status's Introduction

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

ember-online-status's People

Contributors

adamward1995 avatar jrjohnson avatar ember-tomster avatar

Stargazers

Michael Swanson avatar Sean Goresht avatar Jan-Philipp Dombrowski avatar Daniel Gynn avatar

Forkers

jrjohnson

ember-online-status's Issues

hosting demo application on GitHub pages

I played around for a few hours trying to get the demo app on GitHub pages but could not get the production build to finish. Would appreciate it if someone else could see if it will work on their system

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.