2.0.3 • Published 6 years ago
@abcum/ember-internet v2.0.3
ember-internet
A utility for working with connection status in an Ember.js app.
Usage
Installation
ember install @abcum/ember-internet
Introduction
The ember-internet addon enables responding to changes to the internet connection status. This enables customisation of notifications, behaviour, and styling depending on the current internet connection status.
The full connection status object is made available inside all routes, controllers, and components.
Examples
Displaying the current status.
{{internet.status}}
Using the current route info inside an Ember controller.
export default Ember.Controller.extend({
status: Ember.observer('internet.status', function() {
// Do something with the current connection status
alert(`You are now ${internet.status}.`);
})
})
Using the current route info inside handlebars templates.
<button class="{{if internet.offline 'disabled'}}">
Save
</button>
Properties
The following properties are available.
Object property | Example output |
---|---|
internet.status | online |
internet.online | true |
internet.offline | false |
Development
make install
(install bower and ember-cli dependencies)make upgrade
(upgrade ember-cli to the specified version)make tests
(run all tests defined in the package)