Skip to content

Commit

Permalink
exit more gracefully if Polymer isn't loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
bnavetta committed Jan 1, 2016
1 parent ca50db2 commit 22fc1a0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
5 changes: 5 additions & 0 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ define(['exports', 'aurelia-framework', 'aurelia-templating-binding', 'aurelia-l
}

function configure(aurelia) {
if (!('Polymer' in window)) {
logger.error("Polymer is not loaded");
return;
}

var eventManager = aurelia.container.get(_aureliaFramework.EventManager);
var bindingLanguage = aurelia.container.get(_aureliaTemplatingBinding.TemplatingBindingLanguage);
bindingLanguage.attributeMap['bind-value'] = 'bindValue';
Expand Down
5 changes: 5 additions & 0 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ function registerElement(eventManager, bindingLanguage, prototype) {
}

function configure(aurelia) {
if (!('Polymer' in window)) {
logger.error("Polymer is not loaded");
return;
}

var eventManager = aurelia.container.get(_aureliaFramework.EventManager);
var bindingLanguage = aurelia.container.get(_aureliaTemplatingBinding.TemplatingBindingLanguage);

Expand Down
16 changes: 5 additions & 11 deletions dist/es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ function registerElement(eventManager, bindingLanguage, prototype) {
}

export function configure(aurelia){
if (!('Polymer' in window)) {
logger.error("Polymer is not loaded");
return;
}

let eventManager = aurelia.container.get(EventManager);
let bindingLanguage = aurelia.container.get(TemplatingBindingLanguage);
// let observerLocator = aurelia.container.get(ObserverLocator);
Expand All @@ -49,15 +54,4 @@ export function configure(aurelia){
oldRegistrate(prototype);
registerElement(eventManager, bindingLanguage, prototype);
};

// observerLocator.getArrayObserver(registrations).subscribe(changes => {
// changes.forEach(change => {
// if (change.type === "splice" && change.addedCount > 0) {
// for (let i = 0; i < change.addedCount; i++) {
// let prototype = change.object[change.index + i - 1];
// registerElement(eventManager, bindingLanguage, prototype);
// }
// }
// });
// });
}
5 changes: 5 additions & 0 deletions dist/system/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ System.register(['aurelia-framework', 'aurelia-templating-binding', 'aurelia-log
logger = LogManager.getLogger('polymer');

function configure(aurelia) {
if (!('Polymer' in window)) {
logger.error("Polymer is not loaded");
return;
}

var eventManager = aurelia.container.get(EventManager);
var bindingLanguage = aurelia.container.get(TemplatingBindingLanguage);
bindingLanguage.attributeMap['bind-value'] = 'bindValue';
Expand Down
16 changes: 5 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ function registerElement(eventManager, bindingLanguage, prototype) {
}

export function configure(aurelia){
if (!('Polymer' in window)) {
logger.error("Polymer is not loaded");
return;
}

let eventManager = aurelia.container.get(EventManager);
let bindingLanguage = aurelia.container.get(TemplatingBindingLanguage);
// let observerLocator = aurelia.container.get(ObserverLocator);
Expand All @@ -49,15 +54,4 @@ export function configure(aurelia){
oldRegistrate(prototype);
registerElement(eventManager, bindingLanguage, prototype);
};

// observerLocator.getArrayObserver(registrations).subscribe(changes => {
// changes.forEach(change => {
// if (change.type === "splice" && change.addedCount > 0) {
// for (let i = 0; i < change.addedCount; i++) {
// let prototype = change.object[change.index + i - 1];
// registerElement(eventManager, bindingLanguage, prototype);
// }
// }
// });
// });
}

0 comments on commit 22fc1a0

Please sign in to comment.