app.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. app.displayToast = function(msg) {
  21. var toast = Polymer.dom(document).querySelector('#toast');
  22. toast.text = msg;
  23. toast.show();
  24. };
  25. // Listen for template bound event to know when bindings
  26. // have resolved and content has been stamped to the page
  27. app.addEventListener('dom-change', function() {
  28. console.log('Our app is ready to rock!');
  29. app.p2p = document.querySelector('connection-wrapper');
  30. });
  31. // See https://github.com/Polymer/polymer/issues/1381
  32. window.addEventListener('WebComponentsReady', function() {
  33. // imports are loaded and elements have been registered
  34. });
  35. app._showAbout=function(){
  36. document.querySelector('#pages').select(1);
  37. };
  38. app._showAbout=function(){
  39. document.querySelector('#pages').select(0);
  40. };
  41. })(document);