Skip to content

Commit dacd727

Browse files
Jacob Jewellsethwebster
authored andcommitted
Release 1.0.6 - Add support for baseUrl
add support for baseURL in config use getOwner polyfill
1 parent a9a901a commit dacd727

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

addon/components/new-version-notifier/component.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*jshint esnext:true */
22

33
import Ember from 'ember';
4+
import getOwner from 'ember-getowner-polyfill';
45
import layout from './template';
56

67
export default Ember.Component.extend({
@@ -10,8 +11,18 @@ export default Ember.Component.extend({
1011
versionFileName: "/VERSION.txt",
1112
versionFilePath: Ember.computed.alias("versionFileName"),
1213
updateMessage:"This application has been updated from version {{oldVersion}} to {{newVersion}}. Please save any work, then refresh browser to see changes.",
13-
showReload: true,
14+
showReload: true,
1415
showReloadButton: Ember.computed.alias("showReload"),
16+
url: Ember.computed('versionFileName', function() {
17+
var config = getOwner(this).resolveRegistration('config:environment');
18+
var versionFileName = this.get('versionFileName');
19+
20+
if (!config || config.baseURL === '/') {
21+
return versionFileName;
22+
}
23+
24+
return config.baseURL + versionFileName;
25+
}).readOnly(),
1526
init: function() {
1627
this._super(...arguments);
1728
this.updateVersion();
@@ -24,7 +35,7 @@ export default Ember.Component.extend({
2435
clearTimeout(currentTimeout);
2536
}
2637

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

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-cli-new-version",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"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",
55
"directories": {
66
"doc": "doc",
@@ -12,8 +12,8 @@
1212
"test": "ember try:testall"
1313
},
1414
"repository": {
15-
"type" : "git",
16-
"url" : "https://github.com/sethwebster/ember-cli-new-version.git"
15+
"type": "git",
16+
"url": "https://github.com/sethwebster/ember-cli-new-version.git"
1717
},
1818
"engines": {
1919
"node": ">= 0.10.0"
@@ -35,9 +35,10 @@
3535
"ember-cli-sri": "^1.2.0",
3636
"ember-cli-uglify": "^1.2.0",
3737
"ember-data": "1.13.15",
38+
"ember-disable-prototype-extensions": "^1.0.0",
3839
"ember-disable-proxy-controllers": "^1.0.1",
3940
"ember-export-application-global": "^1.0.4",
40-
"ember-disable-prototype-extensions": "^1.0.0",
41+
"ember-getowner-polyfill": "1.0.1",
4142
"ember-try": "~0.0.8"
4243
},
4344
"keywords": [

0 commit comments

Comments
 (0)