49 lines
1.7 KiB
JavaScript
49 lines
1.7 KiB
JavaScript
(function(document) {
|
|
'use strict';
|
|
|
|
// Grab a reference to our auto-binding template
|
|
// and give it some initial binding values
|
|
// Learn more about auto-binding templates at http://goo.gl/Dx1u2g
|
|
var app = document.querySelector('#app');
|
|
|
|
// Sets app default base URL
|
|
app.baseUrl = '/';
|
|
if (window.location.port === '') { // if production
|
|
// Uncomment app.baseURL below and
|
|
// set app.baseURL to '/your-pathname/' if running from folder in production
|
|
// app.baseUrl = '/polymer-starter-kit/';
|
|
}
|
|
|
|
app.displayInstalledToast = function() {
|
|
// Check to make sure caching is actually enabled—it won't be in the dev environment.
|
|
if (!Polymer.dom(document).querySelector('platinum-sw-cache').disabled) {
|
|
Polymer.dom(document).querySelector('#caching-complete').show();
|
|
}
|
|
};
|
|
|
|
app.displayToast = function(msg) {
|
|
var toast = Polymer.dom(document).querySelector('#toast');
|
|
toast.text = msg;
|
|
toast.show();
|
|
};
|
|
|
|
// Listen for template bound event to know when bindings
|
|
// have resolved and content has been stamped to the page
|
|
app.addEventListener('dom-change', function() {
|
|
console.log('Our app is ready to rock!');
|
|
app.conn = document.querySelector('connection-wrapper');
|
|
});
|
|
|
|
// See https://github.com/Polymer/polymer/issues/1381
|
|
window.addEventListener('WebComponentsReady', function() {
|
|
// imports are loaded and elements have been registered
|
|
|
|
});
|
|
|
|
app._showAbout=function(){
|
|
document.querySelector('#pages').select(1);
|
|
};
|
|
app._showAbout=function(){
|
|
document.querySelector('#pages').select(0);
|
|
};
|
|
})(document);
|