Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PlayerFactory = function(Actions, song) {
- function PlayerStore() {
- global.EventEmitter.call(this);
- this.dispatcher = song.getDispatcher('trkstr');
- this.Events = PlayerStore.Events;
- this.currentTrack = { title: "Nothing Playing..." };
- this.doPlay = this.dispatcher.register(Actions.Play, this.play.bind(this));
- }
- PlayerStore.prototype = Object.create(EventEmitter.prototype);
- PlayerStore.prototype.play = function(playAction) {
- this.currentTrack = playAction.track;
- this.emit(PlayerStore.Events.TrackChanged);
- };
- PlayerStore.Events = {
- TrackChanged: 'TrackChanged'
- };
- return new PlayerStore();
- };
- PlayerFactory.$inject = [ 'TrkstrActions', 'songFactory' ];
- angular.module('trkstr.stores.player', [
- 'trkstr.actions', 'songFlux'
- ]).factory('PlayerStore', PlayerFactory);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement