Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. PlayerFactory = function(Actions, song) {
  2. function PlayerStore() {
  3. global.EventEmitter.call(this);
  4. this.dispatcher = song.getDispatcher('trkstr');
  5. this.Events = PlayerStore.Events;
  6.  
  7. this.currentTrack = { title: "Nothing Playing..." };
  8. this.doPlay = this.dispatcher.register(Actions.Play, this.play.bind(this));
  9. }
  10. PlayerStore.prototype = Object.create(EventEmitter.prototype);
  11.  
  12. PlayerStore.prototype.play = function(playAction) {
  13. this.currentTrack = playAction.track;
  14. this.emit(PlayerStore.Events.TrackChanged);
  15. };
  16.  
  17. PlayerStore.Events = {
  18. TrackChanged: 'TrackChanged'
  19. };
  20.  
  21. return new PlayerStore();
  22. };
  23.  
  24. PlayerFactory.$inject = [ 'TrkstrActions', 'songFactory' ];
  25. angular.module('trkstr.stores.player', [
  26. 'trkstr.actions', 'songFlux'
  27. ]).factory('PlayerStore', PlayerFactory);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement