Skip to content

Let your Ember app check for a more recent version of itself

License

Notifications You must be signed in to change notification settings

BrainCheck/ember-cli-self-update

 
 

Repository files navigation

Ember-cli-self-update TravisCI Badge

Let your Ember app check for a more recent version of itself.

What?

This addon offers a service for your Ember applications that periodically checks if a newer version of your app is available.

It allows you to build a nice UX (not included) for your users so they can always benefit from the latest version of your code.

Why?

A classical syndrome in SPAs is that the users never close the tab/window.

It means that there are potentially many versions of your app running in the wild.

This Ember-cli addon allows you to better limit the number of live versions by automatically checking that a newer version is available, and reload the app with the latest version.

How?

Inject the service where you see fit. Here in the ``ApplicationController`:

//app/controllers/application.js

import Ember from 'ember';

export default Ember.Controller.extend({
  selfupdate: Ember.inject.service(),
  willInitSelfUpdate: function() {
    this.get('selfupdate').watchUpdates();
  }.on('init')
});

Configuration

Disable self update

You can also allow/disallow self-updates trough configuration:

//config/environment.js

ENV.APP.allowSelfUpdate = false;

The self-updates are disabled if and only if the value of allowSelfUpdate is false.

Change the endpoint

The endpoint (which is really only the destination of the generated JSON file) can be configured:

//config/environment.js

ENV.APP.versionEndpoint = 'myVersionFile.json';

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

About

Let your Ember app check for a more recent version of itself

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 87.5%
  • HTML 12.5%