sound-notification-behavior.html 633 B

123456789101112131415161718192021222324
  1. <link rel="import" href="sound-notification.html">
  2. <script>
  3. 'use strict';
  4. Chat = window.Chat || {};
  5. Chat.SoundNotificationBehavior = {
  6. sounds: function() {
  7. var sounds = document.querySelector('sound-notification');
  8. if (!sounds) {
  9. sounds = Polymer.Base.create('sound-notification');
  10. document.body.appendChild(sounds);
  11. }
  12. return sounds;
  13. },
  14. attached: function() {
  15. //lazy load sound files
  16. setTimeout(function() {
  17. this.sounds();
  18. }.bind(this), 1000);
  19. },
  20. playSound: function(e) {
  21. this.sounds().play();
  22. }
  23. };
  24. </script>