How about something like that? I have not tested some of them (the WebComponentsReady event can only be fired in a window), but if you can post jsbin or codepin that will help:
Polymer('window-base', {
name: 'Finder',
domReady: function() {
this.nameChanged();
},
nameChanged: function() {
var importElem = document.createElement('link');
importElem.rel = 'import';
importElem.href = 'app-window/' + name + '-app.html';
importElem.addEventListener('WebComponentsReady', function() {
var app = document.createElement(this.name + "-app");
this.$.app.appendChild(app);
}.bind(this));
this.appendChild(importElem);
}
});
source
share