UNPKG

ldx-widgets

Version:

widgets

59 lines (50 loc) 1.91 kB
(function() { var Flux, Global, Validation, actionModule, dispatcher, i, len, processActions, ref; Flux = require('delorean').Flux; Global = require('./flux/global_store'); Validation = require('./flux/validation_store'); dispatcher = { viewTriggers: {}, getStores: function() { return { global: Global, validation: Validation }; } }; processActions = function(actionModule) { var action, actionName, results, triggerMethod, triggerName; results = []; for (actionName in actionModule) { action = actionModule[actionName]; if (actionName === 'viewTriggers') { results.push((function() { var results1; results1 = []; for (triggerName in action) { triggerMethod = action[triggerName]; if (dispatcher.viewTriggers[triggerName] != null) { results1.push(typeof console !== "undefined" && console !== null ? console.warn("Duplicate View Trigger: " + triggerName + ". " + triggerName + " will not be applied to the dispatcher viewTriggers hash.") : void 0); } else { results1.push(dispatcher.viewTriggers[triggerName] = triggerMethod); } } return results1; })()); } else { if (dispatcher[actionName] != null) { results.push(typeof console !== "undefined" && console !== null ? console.warn("Duplicate Dispatcher Action: " + actionName + ". " + actionName + " will not be applied to the dispatcher.") : void 0); } else { results.push(dispatcher[actionName] = action); } } } return results; }; ref = [require('./flux/validation_actions')]; for (i = 0, len = ref.length; i < len; i++) { actionModule = ref[i]; processActions(actionModule); } module.exports = Flux.createDispatcher(dispatcher); }).call(this);