Skip to content

Instantly share code, notes, and snippets.

@danscotton
Created May 28, 2015 14:47
Show Gist options
  • Save danscotton/9900c9ab2d7fb8a31b32 to your computer and use it in GitHub Desktop.
Save danscotton/9900c9ab2d7fb8a31b32 to your computer and use it in GitHub Desktop.
Version B: Separate files for Actions and Events
'use strict';
var events = require('./events');
module.exports = {
display: function ( notice ) {
this.dispatch( events.DISPLAY, notice );
},
dismiss: function ( noticeId ) {
this.dispatch( events.DISMISS, noticeId );
},
fetchMixes: function () {
this.dispatch( events.FETCH_MIXES, mixGroupId );
API('mixes').getMixGroup({ id: mixGroupId }).then(
this.dispatch.bind( this, events.FETCH_MIXES_SUCCESS ),
this.dispatch.bind( this, events.FETCH_MIXES_FAIL )
);
}
};
'use strict';
module.exports = {
CHANGE: 'change',
DISPLAY: 'DISPLAY',
DISMISS: 'DISMISS',
FETCH_MIXES: 'FETCH_MIXES',
FETCH_MIXES_SUCCESS: 'FETCH_MIXES_SUCCESS',
FETCH_MIXES_FAIL: 'FETCH_MIXES_FAIL'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment