locale store and test

This commit is contained in:
Peter Cottle 2015-03-27 21:36:03 -07:00
parent eba404c595
commit ef74ac1cf8
4 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,7 @@
var LocaleStore = require('../stores/LocaleStore');
describe('LocaleStore', function() {
it('changes locales', function() {
});
});

View file

@ -8,6 +8,7 @@ var ActionTypes = AppConstants.ActionTypes;
var LocaleActions = {
changeLocale: function(newLocale) {
console.log('firingt his off', newLocale);
AppDispatcher.handleViewAction({
type: ActionTypes.CHANGE_LOCALE,
locale: newLocale

View file

@ -8,6 +8,7 @@ var PayloadSources = AppConstants.PayloadSources;
var AppDispatcher = new Dispatcher();
AppDispatcher.handleViewAction = function(action) {
console.log('dispatching', action);
this.dispatch({
source: PayloadSources.VIEW_ACTION,
action: action

View file

@ -30,10 +30,13 @@ var LocaleStore = assign({}, EventEmitter.prototype, {
switch (action.type) {
case ActionTypes.CHANGE_LOCALE:
_locale = action.locale;
shouldInform = true;
break;
}
if (shouldInform) {
this.emit(CHANGE_EVENT);
LocaleStore.emit(CHANGE_EVENT);
}
})