Skip to content

Commit

Permalink
Release 1.0.6 - Add support for baseUrl
Browse files Browse the repository at this point in the history
add support for baseURL in config

use getOwner polyfill
  • Loading branch information
jakesjews authored and sethwebster committed Apr 27, 2016
1 parent a9a901a commit dacd727
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 13 additions & 2 deletions addon/components/new-version-notifier/component.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*jshint esnext:true */

import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import layout from './template';

export default Ember.Component.extend({
Expand All @@ -10,8 +11,18 @@ export default Ember.Component.extend({
versionFileName: "/VERSION.txt",
versionFilePath: Ember.computed.alias("versionFileName"),
updateMessage:"This application has been updated from version {{oldVersion}} to {{newVersion}}. Please save any work, then refresh browser to see changes.",
showReload: true,
showReload: true,
showReloadButton: Ember.computed.alias("showReload"),
url: Ember.computed('versionFileName', function() {
var config = getOwner(this).resolveRegistration('config:environment');
var versionFileName = this.get('versionFileName');

if (!config || config.baseURL === '/') {
return versionFileName;
}

return config.baseURL + versionFileName;
}).readOnly(),
init: function() {
this._super(...arguments);
this.updateVersion();
Expand All @@ -24,7 +35,7 @@ export default Ember.Component.extend({
clearTimeout(currentTimeout);
}

Ember.$.ajax(self.get("versionFileName"), { cache:false }).then(function(res){
Ember.$.ajax(self.get('url'), { cache:false }).then(function(res){
var currentVersion = self.get('version');
var newVersion = res && res.trim();

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-cli-new-version",
"version": "1.0.5",
"version": "1.0.6",
"description": "A convention based update notification for Ember. With this addon, you can detect a new version and notify the user to refresh the page",
"directories": {
"doc": "doc",
Expand All @@ -12,8 +12,8 @@
"test": "ember try:testall"
},
"repository": {
"type" : "git",
"url" : "https://github.com/sethwebster/ember-cli-new-version.git"
"type": "git",
"url": "https://github.com/sethwebster/ember-cli-new-version.git"
},
"engines": {
"node": ">= 0.10.0"
Expand All @@ -35,9 +35,10 @@
"ember-cli-sri": "^1.2.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "1.13.15",
"ember-disable-prototype-extensions": "^1.0.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-disable-prototype-extensions": "^1.0.0",
"ember-getowner-polyfill": "1.0.1",
"ember-try": "~0.0.8"
},
"keywords": [
Expand Down

0 comments on commit dacd727

Please sign in to comment.