app.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. (function(document) {
  2. 'use strict';
  3. // Grab a reference to our auto-binding template
  4. // and give it some initial binding values
  5. // Learn more about auto-binding templates at http://goo.gl/Dx1u2g
  6. var app = document.querySelector('#app');
  7. // Sets app default base URL
  8. app.baseUrl = '/';
  9. if (window.location.port === '') { // if production
  10. // Uncomment app.baseURL below and
  11. // set app.baseURL to '/your-pathname/' if running from folder in production
  12. // app.baseUrl = '/polymer-starter-kit/';
  13. }
  14. app.displayInstalledToast = function() {
  15. // Check to make sure caching is actually enabled—it won't be in the dev environment.
  16. if (!Polymer.dom(document).querySelector('platinum-sw-cache').disabled) {
  17. Polymer.dom(document).querySelector('#caching-complete').show();
  18. }
  19. };
  20. // Listen for template bound event to know when bindings
  21. // have resolved and content has been stamped to the page
  22. app.addEventListener('dom-change', function() {
  23. console.log('Our app is ready to rock!');
  24. });
  25. // See https://github.com/Polymer/polymer/issues/1381
  26. window.addEventListener('WebComponentsReady', function() {
  27. // imports are loaded and elements have been registered
  28. app.p2p = document.querySelector('p2p-network');
  29. });
  30. })(document);