Created
May 28, 2015 14:47
-
-
Save danscotton/9900c9ab2d7fb8a31b32 to your computer and use it in GitHub Desktop.
Version B: Separate files for Actions and Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 ) | |
); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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