Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

delorean

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delorean - npm Package Compare versions

Comparing version 0.9.3 to 0.9.4

44

dist/delorean.js

@@ -1,2 +0,2 @@

/*! delorean - v0.8.7 - 2015-03-24 */
/*! delorean - v0.8.7 - 2015-05-27 */
(function (DeLorean) {

@@ -36,12 +36,7 @@ 'use strict';

function __findDispatcher(view) {
// Provide a useful error message if no dispatcher is found in the chain
if (view == null) {
throw 'No dispatcher found. The DeLoreanJS mixin requires a "dispatcher" property to be passed to a component, or one of it\'s ancestors.';
// Provide a useful error message if no dispatcher is found
if (DeLorean.dispatcher == null) {
throw 'No dispatcher found. The DeLoreanJS mixin requires a "dispatcher" has been created using Flux.createDispatcher.';
}
/* `view` should be a component instance. If a component don't have
any dispatcher, it tries to find a dispatcher from the parents. */
if (!view.props.dispatcher) {
return __findDispatcher(view._owner);
}
return view.props.dispatcher;
return DeLorean.dispatcher;
}

@@ -115,6 +110,8 @@

// `dispatch` method dispatch the event with `data` (or **payload**)
Dispatcher.prototype.dispatch = function (actionName, data) {
var self = this, stores, deferred;
Dispatcher.prototype.dispatch = function () {
var self = this, stores, deferred, args;
args = Array.prototype.slice.call(arguments);
this.listener.emit('dispatch', actionName, data);
this.listener.emit.apply(this.listener, ['dispatch'].concat(args));
/* Stores are key-value pairs. Collect store instances into an array. */

@@ -136,7 +133,7 @@ stores = (function () {

// stores are dispatched properly.
deferred = this.waitFor(stores, actionName);
deferred = this.waitFor(stores, args[0]);
/* Payload should send to all related stores. */
for (var storeName in self.stores) {
self.stores[storeName].dispatchAction(actionName, data);
self.stores[storeName].dispatchAction.apply(self.stores[storeName], args);
}

@@ -541,2 +538,12 @@

// Allow only a single dispatcher
if (DeLorean.dispatcher != null) {
if (console != null) {
console.warn('You are attempting to create more than one dispatcher. DeLorean is intended to be used with a single dispatcher. This latest dispatcher created will overwrite any previous versions.');
}
}
// Create an internal reference to the dispathcer instance. This allows it to be found by the mixins.
DeLorean.dispatcher = dispatcher;
return dispatcher;

@@ -659,2 +666,9 @@ },

getStore: function (storeName) {
if (console != null && typeof this.__watchStores[storeName] === 'undefined') {
var message;
message = 'Attempt to getStore ' + storeName + ' failed. ';
message += typeof this.stores[storeName] === 'undefined' ? 'It is not defined on the dispatcher. ' : 'It is not being watched by the component. ';
message += this.constructor != null && this.constructor.displayName != null ? 'Check the ' + this.constructor.displayName + ' component.' : '';
console.warn(message);
}
return this.state.stores[storeName];

@@ -661,0 +675,0 @@ }

@@ -1,2 +0,2 @@

!function(DeLorean){"use strict";function a(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function b(a){return"action:"+a}function c(a){return"original:"+a}function d(a){if(null==a)throw'No dispatcher found. The DeLoreanJS mixin requires a "dispatcher" property to be passed to a component, or one of it\'s ancestors.';return a.props.dispatcher?a.props.dispatcher:d(a._owner)}function e(b){if(null===b||"object"!=typeof b)return b;var c=b.constructor();for(var d in b)a(b,d)&&(c[d]=e(b[d]));return c}function f(a,b){b=e(b);for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}var Dispatcher,Store;if(Dispatcher=function(){function a(a){function b(){for(var b in a)a[b].listener.emit("__rollback")}for(var c in a)a[c].listener.on("rollback",b)}function Dispatcher(b){this.listener=new DeLorean.EventEmitter,this.stores=b,a(Object.keys(b).map(function(a){return b[a]}))}return Dispatcher.prototype.dispatch=function(a,b){var c,d,e=this;this.listener.emit("dispatch",a,b),c=function(){var a,b=[];for(var c in e.stores){if(a=e.stores[c],!a instanceof Store)throw"Given store is not a store instance";b.push(a)}return b}(),d=this.waitFor(c,a);for(var f in e.stores)e.stores[f].dispatchAction(a,b);return d},Dispatcher.prototype.waitFor=function(a,b){var c,d=this;return c=function(){function c(a){return new DeLorean.Promise(function(b){a.listener.once("change",b)})}var d,e=[];for(var f in a)a[f].actions&&null!=a[f].actions[b]&&(d=c(a[f]),e.push(d));return e}(),DeLorean.Promise.all(c).then(function(){d.listener.emit("change:all")})},Dispatcher.prototype.registerAction=function(a,b){if("function"!=typeof b)throw"Action callback should be a function.";this[a]=b.bind(this.stores)},Dispatcher.prototype.register=function(a){if("function"!=typeof a)throw"Global callback should be a function.";this.listener.on("dispatch",a)},Dispatcher.prototype.getStore=function(a){if(!this.stores[a])throw"Store "+a+" does not exist.";return this.stores[a].getState()},Dispatcher.prototype.on=function(){return this.listener.on.apply(this.listener,arguments)},Dispatcher.prototype.off=function(){return this.listener.removeListener.apply(this.listener,arguments)},Dispatcher.prototype.emit=function(){return this.listener.emit.apply(this.listener,arguments)},Dispatcher}(),Store=function(){function Store(){this.state||(this.state={}),this.listener=new DeLorean.EventEmitter,this.bindActions(),this.buildScheme(),this.initialize.apply(this,arguments)}return Store.prototype.initialize=function(){},Store.prototype.get=function(a){return this.state[a]},Store.prototype.set=function(a,b){var c=[];if("object"==typeof a)for(var d in a)c.push(d),this.setValue(d,a[d]);else c.push(a),this.setValue(a,b);return this.recalculate(c),this.state[a]},Store.prototype.setValue=function(a,b){var d,e=this.scheme;return e&&this.scheme[a]?(d=e[a],this.state[a]="undefined"!=typeof b?b:d.default,"function"==typeof d.calculate&&(this.state[c(a)]=b,this.state[a]=d.calculate.call(this,b))):null!=console&&console.warn("Scheme must include the key, "+a+", you are trying to set. "+a+" will NOT be set on the store."),this.state[a]},Store.prototype.formatScheme=function(a){var b,c,d,e={};for(var f in a)b=a[f],c=null,d=null,e[f]={"default":null},c=b&&"object"==typeof b?b.default:b,e[f].default=c,b&&"function"==typeof b.calculate?(d=b.calculate,e[f].deps=b.deps?b.deps:[]):"function"==typeof b&&(d=b),d&&(e[f].calculate=d);return e},Store.prototype.buildScheme=function(){var a,b,d,f,g,h,i=[];if("object"==typeof this.scheme){a=this.scheme=this.formatScheme(this.scheme),f=this.__dependencyMap={};for(b in a)d=a[b],this.state[b]=e(d.default);for(b in a)if(d=a[b],d.calculate){g=d.deps||[];for(var j=0;j<g.length;j++)h=g[j],null==f[h]&&(f[h]=[]),f[h].push(b);this.state[c(b)]=d.default,this.state[b]=d.calculate.call(this,d.default),i.push(b)}this.recalculate(i)}},Store.prototype.recalculate=function(a){for(var b,d,e,f=this.scheme,g=this.__dependencyMap,h=[],i=0;i<a.length;i++)if(d=g[a[i]],null!=d)for(var j=0;j<d.length;j++)e=d[j],-1===h.indexOf(e)&&(b=f[e],this.state[e]=b.calculate.call(this,this.state[c(e)]||b.default),h.push(e));h.length>0&&this.recalculate(h),this.listener.emit("change")},Store.prototype.getState=function(){return this.state},Store.prototype.clearState=function(){return this.state={},this},Store.prototype.resetState=function(){return this.buildScheme(),this.listener.emit("change"),this},Store.prototype.bindActions=function(){var c;this.emitChange=this.listener.emit.bind(this.listener,"change"),this.emitRollback=this.listener.emit.bind(this.listener,"rollback"),this.rollback=this.listener.on.bind(this.listener,"__rollback"),this.emit=this.listener.emit.bind(this.listener);for(var d in this.actions)if(a(this.actions,d)){if(c=this.actions[d],"function"!=typeof this[c])throw"Callback '"+c+"' defined for action '"+d+"' should be a method defined on the store!";this.listener.on(b(d),this[c].bind(this))}},Store.prototype.dispatchAction=function(a,c){this.listener.emit(b(a),c)},Store.prototype.listenChanges=function(a){var b,c=this;return Object.observe?(b=Array.isArray(a)?Array.observe:Object.observe,void b(a,function(a){c.listener.emit("change",a)})):void console.error("Store#listenChanges method uses Object.observe, you should fire changes manually.")},Store.prototype.onChange=function(a){this.listener.on("change",a)},Store}(),DeLorean.Flux={createStore:function(a){if("object"!=typeof a)throw"Stores should be defined by passing the definition to the constructor";var b=function(){return Store.apply(this,arguments)},c=function(){this.constructor=b};return c.prototype=Store.prototype,b.prototype=new c,f(b.prototype,a),new b},createDispatcher:function(b){var c,d,e,f,g;"function"==typeof b.getStores&&(c=b.getStores()),d=new Dispatcher(c||{});for(var h in b)a(b,h)&&"getStores"!==h&&"viewTriggers"!==h&&"function"==typeof b[h]&&(e=b[h],d.registerAction(h,e.bind(d)));f=b.viewTriggers;for(var i in f)g=f[i],"function"==typeof d[g]?d.on(i,d[g]):null!=console&&console.warn(g+" should be a method defined on your dispatcher. The "+i+" trigger will not be bound to any method.");return d},define:function(a,b){DeLorean[a]=b}},DeLorean.Dispatcher=Dispatcher,DeLorean.Store=Store,DeLorean.Flux.mixins={storeListener:{trigger:function(){this.__dispatcher.emit.apply(this.__dispatcher,arguments)},componentDidMount:function(){function b(a,b){return function(){var a;e.isMounted()&&e.setState(e.getStoreStates()),e.storeDidChange&&(a=[b].concat(Array.prototype.slice.call(arguments,0)),e.storeDidChange.apply(e,a))}}var c,d,e=this;this.__changeHandlers={};for(d in this.__watchStores)a(this.stores,d)&&(c=this.stores[d],this.__changeHandlers[d]=b(c,d),c.onChange(this.__changeHandlers[d]))},componentWillUnmount:function(){for(var b in this.__changeHandlers)if(a(this.stores,b)){var c=this.stores[b];c.listener.removeListener("change",this.__changeHandlers[b])}},getInitialState:function(){var a,b=this;if(this.__dispatcher=d(this),this.storesDidChange&&this.__dispatcher.on("change:all",function(){b.storesDidChange()}),this.stores=this.__dispatcher.stores,this.__watchStores={},null!=this.watchStores)for(var c=0;c<this.watchStores.length;c++)a=this.watchStores[c],this.__watchStores[a]=this.stores[a];else this.__watchStores=this.stores,null!=console&&null!=Object.keys&&Object.keys(this.stores).length>4&&console.warn('Your component is watching changes on all stores, you may want to define a "watchStores" property in order to only watch stores relevant to this component.');return this.getStoreStates()},getStoreStates:function(){var b={stores:{}};for(var c in this.__watchStores)a(this.stores,c)&&(b.stores[c]=this.__watchStores[c].getState());return b},getStore:function(a){return this.state.stores[a]}}},"undefined"!=typeof module&&"undefined"!=typeof module.exports){var g=require("./requirements");for(var h in g)DeLorean.Flux.define(h,g[h]);module.exports=DeLorean}else"function"==typeof define&&define.amd?define(["./requirements.js"],function(a){for(var b in a)DeLorean.Flux.define(b,a[b]);return DeLorean}):window.DeLorean=DeLorean}({}),function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("./promise/promise").Promise,e=a("./promise/polyfill").polyfill;c.Promise=d,c.polyfill=e},{"./promise/polyfill":5,"./promise/promise":6}],2:[function(a,b,c){"use strict";function d(a){var b=this;if(!e(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){e(a,b)}}function e(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&f(g.then)?g.then(d(j),c):e(j,g)})}var e=a("./utils").isArray,f=a("./utils").isFunction;c.all=d},{"./utils":10}],3:[function(a,b,c){(function(a,b){"use strict";function d(){return function(){a.nextTick(g)}}function e(){var a=0,b=new k(g),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function f(){return function(){l.setTimeout(g,1)}}function g(){for(var a=0;a<m.length;a++){var b=m[a],c=b[0],d=b[1];c(d)}m=[]}function h(a,b){var c=m.push([a,b]);1===c&&i()}var i,j="undefined"!=typeof window?window:{},k=j.MutationObserver||j.WebKitMutationObserver,l="undefined"!=typeof b?b:void 0===this?window:this,m=[];i="undefined"!=typeof a&&"[object process]"==={}.toString.call(a)?d():k?e():f(),c.asap=h}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{JkpR2F:12}],4:[function(a,b,c){"use strict";function d(a,b){return 2!==arguments.length?e[a]:void(e[a]=b)}var e={instrument:!1};c.config=e,c.configure=d},{}],5:[function(a,b,c){(function(b){"use strict";function d(){var a;a="undefined"!=typeof b?b:"undefined"!=typeof window&&window.document?window:self;var c="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();c||(a.Promise=e)}var e=a("./promise").Promise,f=a("./utils").isFunction;c.polyfill=d}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./promise":6,"./utils":10}],6:[function(a,b,c){"use strict";function d(a){if(!q(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof d))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],e(a,this)}function e(a,b){function c(a){j(b,a)}function d(a){l(b,a)}try{a(c,d)}catch(e){d(e)}}function f(a,b,c,d){var e,f,g,h,k=q(c);if(k)try{e=c(d),g=!0}catch(m){h=!0,f=m}else e=d,g=!0;i(b,e)||(k&&g?j(b,e):h?l(b,f):a===y?j(b,e):a===z&&l(b,e))}function g(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+y]=c,e[f+z]=d}function h(a,b){for(var c,d,e=a._subscribers,g=a._detail,h=0;h<e.length;h+=3)c=e[h],d=e[h+b],f(b,c,d,g);a._subscribers=null}function i(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(p(b)&&(d=b.then,q(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?j(a,d):k(a,d)))},function(b){return c?!0:(c=!0,void l(a,b))}),!0}catch(e){return c?!0:(l(a,e),!0)}return!1}function j(a,b){a===b?k(a,b):i(a,b)||k(a,b)}function k(a,b){a._state===w&&(a._state=x,a._detail=b,o.async(m,a))}function l(a,b){a._state===w&&(a._state=x,a._detail=b,o.async(n,a))}function m(a){h(a,a._state=y)}function n(a){h(a,a._state=z)}var o=a("./config").config,p=(a("./config").configure,a("./utils").objectOrFunction),q=a("./utils").isFunction,r=(a("./utils").now,a("./all").all),s=a("./race").race,t=a("./resolve").resolve,u=a("./reject").reject,v=a("./asap").asap;o.async=v;var w=void 0,x=0,y=1,z=2;d.prototype={constructor:d,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;o.async(function(){f(c._state,d,e[c._state-1],c._detail)})}else g(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},d.all=r,d.race=s,d.resolve=t,d.reject=u,c.Promise=d},{"./all":2,"./asap":3,"./config":4,"./race":7,"./reject":8,"./resolve":9,"./utils":10}],7:[function(a,b,c){"use strict";function d(a){var b=this;if(!e(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var e=a("./utils").isArray;c.race=d},{"./utils":10}],8:[function(a,b,c){"use strict";function d(a){var b=this;return new b(function(b,c){c(a)})}c.reject=d},{}],9:[function(a,b,c){"use strict";function d(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}c.resolve=d},{}],10:[function(a,b,c){"use strict";function d(a){return e(a)||"object"==typeof a&&null!==a}function e(a){return"function"==typeof a}function f(a){return"[object Array]"===Object.prototype.toString.call(a)}var g=Date.now||function(){return(new Date).getTime()};c.objectOrFunction=d,c.isFunction=e,c.isArray=f,c.now=g},{}],11:[function(a,b){function c(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function d(a){return"function"==typeof a}function e(a){return"number"==typeof a}function f(a){return"object"==typeof a&&null!==a}function g(a){return void 0===a}b.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.prototype.setMaxListeners=function(a){if(!e(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},c.prototype.emit=function(a){var b,c,e,h,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||f(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],g(c))return!1;if(d(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];c.apply(this,h)}else if(f(c)){for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];for(j=c.slice(),e=j.length,i=0;e>i;i++)j[i].apply(this,h)}return!0},c.prototype.addListener=function(a,b){var e;if(!d(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,d(b.listener)?b.listener:b),this._events[a]?f(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,f(this._events[a])&&!this._events[a].warned){var e;e=g(this._maxListeners)?c.defaultMaxListeners:this._maxListeners,e&&e>0&&this._events[a].length>e&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},c.prototype.on=c.prototype.addListener,c.prototype.once=function(a,b){function c(){this.removeListener(a,c),e||(e=!0,b.apply(this,arguments))}if(!d(b))throw TypeError("listener must be a function");var e=!1;return c.listener=b,this.on(a,c),this},c.prototype.removeListener=function(a,b){var c,e,g,h;if(!d(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],g=c.length,e=-1,c===b||d(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(f(c)){for(h=g;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){e=h;break}if(0>e)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(e,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},c.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],d(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},c.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?d(this._events[a])?[this._events[a]]:this._events[a].slice():[]},c.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?d(a._events[b])?1:a._events[b].length:0}},{}],12:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],13:[function(a,b){var c;if("undefined"!=typeof b&&"undefined"!=typeof b.exports?b.exports=c={EventEmitter:a("events").EventEmitter,Promise:a("es6-promise").Promise}:"function"==typeof define&&define.amd?define(function(a){a("events"),a("es6-promise");return{EventEmitter:a("events").EventEmitter,Promise:a("es6-promise").Promise}}):window.DeLorean=DeLorean,"undefined"!=typeof DeLorean)for(var d in c)DeLorean.Flux.define(d,c[d])},{"es6-promise":1,events:11}]},{},[13]);
!function(DeLorean){"use strict";function a(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function b(a){return"action:"+a}function c(a){return"original:"+a}function d(){if(null==DeLorean.dispatcher)throw'No dispatcher found. The DeLoreanJS mixin requires a "dispatcher" has been created using Flux.createDispatcher.';return DeLorean.dispatcher}function e(b){if(null===b||"object"!=typeof b)return b;var c=b.constructor();for(var d in b)a(b,d)&&(c[d]=e(b[d]));return c}function f(a,b){b=e(b);for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}var Dispatcher,Store;if(Dispatcher=function(){function a(a){function b(){for(var b in a)a[b].listener.emit("__rollback")}for(var c in a)a[c].listener.on("rollback",b)}function Dispatcher(b){this.listener=new DeLorean.EventEmitter,this.stores=b,a(Object.keys(b).map(function(a){return b[a]}))}return Dispatcher.prototype.dispatch=function(){var a,b,c,d=this;c=Array.prototype.slice.call(arguments),this.listener.emit.apply(this.listener,["dispatch"].concat(c)),a=function(){var a,b=[];for(var c in d.stores){if(a=d.stores[c],!a instanceof Store)throw"Given store is not a store instance";b.push(a)}return b}(),b=this.waitFor(a,c[0]);for(var e in d.stores)d.stores[e].dispatchAction.apply(d.stores[e],c);return b},Dispatcher.prototype.waitFor=function(a,b){var c,d=this;return c=function(){function c(a){return new DeLorean.Promise(function(b){a.listener.once("change",b)})}var d,e=[];for(var f in a)a[f].actions&&null!=a[f].actions[b]&&(d=c(a[f]),e.push(d));return e}(),DeLorean.Promise.all(c).then(function(){d.listener.emit("change:all")})},Dispatcher.prototype.registerAction=function(a,b){if("function"!=typeof b)throw"Action callback should be a function.";this[a]=b.bind(this.stores)},Dispatcher.prototype.register=function(a){if("function"!=typeof a)throw"Global callback should be a function.";this.listener.on("dispatch",a)},Dispatcher.prototype.getStore=function(a){if(!this.stores[a])throw"Store "+a+" does not exist.";return this.stores[a].getState()},Dispatcher.prototype.on=function(){return this.listener.on.apply(this.listener,arguments)},Dispatcher.prototype.off=function(){return this.listener.removeListener.apply(this.listener,arguments)},Dispatcher.prototype.emit=function(){return this.listener.emit.apply(this.listener,arguments)},Dispatcher}(),Store=function(){function Store(){this.state||(this.state={}),this.listener=new DeLorean.EventEmitter,this.bindActions(),this.buildScheme(),this.initialize.apply(this,arguments)}return Store.prototype.initialize=function(){},Store.prototype.get=function(a){return this.state[a]},Store.prototype.set=function(a,b){var c=[];if("object"==typeof a)for(var d in a)c.push(d),this.setValue(d,a[d]);else c.push(a),this.setValue(a,b);return this.recalculate(c),this.state[a]},Store.prototype.setValue=function(a,b){var d,e=this.scheme;return e&&this.scheme[a]?(d=e[a],this.state[a]="undefined"!=typeof b?b:d.default,"function"==typeof d.calculate&&(this.state[c(a)]=b,this.state[a]=d.calculate.call(this,b))):null!=console&&console.warn("Scheme must include the key, "+a+", you are trying to set. "+a+" will NOT be set on the store."),this.state[a]},Store.prototype.formatScheme=function(a){var b,c,d,e={};for(var f in a)b=a[f],c=null,d=null,e[f]={"default":null},c=b&&"object"==typeof b?b.default:b,e[f].default=c,b&&"function"==typeof b.calculate?(d=b.calculate,e[f].deps=b.deps?b.deps:[]):"function"==typeof b&&(d=b),d&&(e[f].calculate=d);return e},Store.prototype.buildScheme=function(){var a,b,d,f,g,h,i=[];if("object"==typeof this.scheme){a=this.scheme=this.formatScheme(this.scheme),f=this.__dependencyMap={};for(b in a)d=a[b],this.state[b]=e(d.default);for(b in a)if(d=a[b],d.calculate){g=d.deps||[];for(var j=0;j<g.length;j++)h=g[j],null==f[h]&&(f[h]=[]),f[h].push(b);this.state[c(b)]=d.default,this.state[b]=d.calculate.call(this,d.default),i.push(b)}this.recalculate(i)}},Store.prototype.recalculate=function(a){for(var b,d,e,f=this.scheme,g=this.__dependencyMap,h=[],i=0;i<a.length;i++)if(d=g[a[i]],null!=d)for(var j=0;j<d.length;j++)e=d[j],-1===h.indexOf(e)&&(b=f[e],this.state[e]=b.calculate.call(this,this.state[c(e)]||b.default),h.push(e));h.length>0&&this.recalculate(h),this.listener.emit("change")},Store.prototype.getState=function(){return this.state},Store.prototype.clearState=function(){return this.state={},this},Store.prototype.resetState=function(){return this.buildScheme(),this.listener.emit("change"),this},Store.prototype.bindActions=function(){var c;this.emitChange=this.listener.emit.bind(this.listener,"change"),this.emitRollback=this.listener.emit.bind(this.listener,"rollback"),this.rollback=this.listener.on.bind(this.listener,"__rollback"),this.emit=this.listener.emit.bind(this.listener);for(var d in this.actions)if(a(this.actions,d)){if(c=this.actions[d],"function"!=typeof this[c])throw"Callback '"+c+"' defined for action '"+d+"' should be a method defined on the store!";this.listener.on(b(d),this[c].bind(this))}},Store.prototype.dispatchAction=function(a,c){this.listener.emit(b(a),c)},Store.prototype.listenChanges=function(a){var b,c=this;return Object.observe?(b=Array.isArray(a)?Array.observe:Object.observe,void b(a,function(a){c.listener.emit("change",a)})):void console.error("Store#listenChanges method uses Object.observe, you should fire changes manually.")},Store.prototype.onChange=function(a){this.listener.on("change",a)},Store}(),DeLorean.Flux={createStore:function(a){if("object"!=typeof a)throw"Stores should be defined by passing the definition to the constructor";var b=function(){return Store.apply(this,arguments)},c=function(){this.constructor=b};return c.prototype=Store.prototype,b.prototype=new c,f(b.prototype,a),new b},createDispatcher:function(b){var c,d,e,f,g;"function"==typeof b.getStores&&(c=b.getStores()),d=new Dispatcher(c||{});for(var h in b)a(b,h)&&"getStores"!==h&&"viewTriggers"!==h&&"function"==typeof b[h]&&(e=b[h],d.registerAction(h,e.bind(d)));f=b.viewTriggers;for(var i in f)g=f[i],"function"==typeof d[g]?d.on(i,d[g]):null!=console&&console.warn(g+" should be a method defined on your dispatcher. The "+i+" trigger will not be bound to any method.");return null!=DeLorean.dispatcher&&null!=console&&console.warn("You are attempting to create more than one dispatcher. DeLorean is intended to be used with a single dispatcher. This latest dispatcher created will overwrite any previous versions."),DeLorean.dispatcher=d,d},define:function(a,b){DeLorean[a]=b}},DeLorean.Dispatcher=Dispatcher,DeLorean.Store=Store,DeLorean.Flux.mixins={storeListener:{trigger:function(){this.__dispatcher.emit.apply(this.__dispatcher,arguments)},componentDidMount:function(){function b(a,b){return function(){var a;e.isMounted()&&e.setState(e.getStoreStates()),e.storeDidChange&&(a=[b].concat(Array.prototype.slice.call(arguments,0)),e.storeDidChange.apply(e,a))}}var c,d,e=this;this.__changeHandlers={};for(d in this.__watchStores)a(this.stores,d)&&(c=this.stores[d],this.__changeHandlers[d]=b(c,d),c.onChange(this.__changeHandlers[d]))},componentWillUnmount:function(){for(var b in this.__changeHandlers)if(a(this.stores,b)){var c=this.stores[b];c.listener.removeListener("change",this.__changeHandlers[b])}},getInitialState:function(){var a,b=this;if(this.__dispatcher=d(this),this.storesDidChange&&this.__dispatcher.on("change:all",function(){b.storesDidChange()}),this.stores=this.__dispatcher.stores,this.__watchStores={},null!=this.watchStores)for(var c=0;c<this.watchStores.length;c++)a=this.watchStores[c],this.__watchStores[a]=this.stores[a];else this.__watchStores=this.stores,null!=console&&null!=Object.keys&&Object.keys(this.stores).length>4&&console.warn('Your component is watching changes on all stores, you may want to define a "watchStores" property in order to only watch stores relevant to this component.');return this.getStoreStates()},getStoreStates:function(){var b={stores:{}};for(var c in this.__watchStores)a(this.stores,c)&&(b.stores[c]=this.__watchStores[c].getState());return b},getStore:function(a){if(null!=console&&"undefined"==typeof this.__watchStores[a]){var b;b="Attempt to getStore "+a+" failed. ",b+="undefined"==typeof this.stores[a]?"It is not defined on the dispatcher. ":"It is not being watched by the component. ",b+=null!=this.constructor&&null!=this.constructor.displayName?"Check the "+this.constructor.displayName+" component.":"",console.warn(b)}return this.state.stores[a]}}},"undefined"!=typeof module&&"undefined"!=typeof module.exports){var g=require("./requirements");for(var h in g)DeLorean.Flux.define(h,g[h]);module.exports=DeLorean}else"function"==typeof define&&define.amd?define(["./requirements.js"],function(a){for(var b in a)DeLorean.Flux.define(b,a[b]);return DeLorean}):window.DeLorean=DeLorean}({}),function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("./promise/promise").Promise,e=a("./promise/polyfill").polyfill;c.Promise=d,c.polyfill=e},{"./promise/polyfill":5,"./promise/promise":6}],2:[function(a,b,c){"use strict";function d(a){var b=this;if(!e(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){e(a,b)}}function e(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&f(g.then)?g.then(d(j),c):e(j,g)})}var e=a("./utils").isArray,f=a("./utils").isFunction;c.all=d},{"./utils":10}],3:[function(a,b,c){(function(a,b){"use strict";function d(){return function(){a.nextTick(g)}}function e(){var a=0,b=new k(g),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function f(){return function(){l.setTimeout(g,1)}}function g(){for(var a=0;a<m.length;a++){var b=m[a],c=b[0],d=b[1];c(d)}m=[]}function h(a,b){var c=m.push([a,b]);1===c&&i()}var i,j="undefined"!=typeof window?window:{},k=j.MutationObserver||j.WebKitMutationObserver,l="undefined"!=typeof b?b:void 0===this?window:this,m=[];i="undefined"!=typeof a&&"[object process]"==={}.toString.call(a)?d():k?e():f(),c.asap=h}).call(this,a("JkpR2F"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{JkpR2F:12}],4:[function(a,b,c){"use strict";function d(a,b){return 2!==arguments.length?e[a]:void(e[a]=b)}var e={instrument:!1};c.config=e,c.configure=d},{}],5:[function(a,b,c){(function(b){"use strict";function d(){var a;a="undefined"!=typeof b?b:"undefined"!=typeof window&&window.document?window:self;var c="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();c||(a.Promise=e)}var e=a("./promise").Promise,f=a("./utils").isFunction;c.polyfill=d}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./promise":6,"./utils":10}],6:[function(a,b,c){"use strict";function d(a){if(!q(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof d))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],e(a,this)}function e(a,b){function c(a){j(b,a)}function d(a){l(b,a)}try{a(c,d)}catch(e){d(e)}}function f(a,b,c,d){var e,f,g,h,k=q(c);if(k)try{e=c(d),g=!0}catch(m){h=!0,f=m}else e=d,g=!0;i(b,e)||(k&&g?j(b,e):h?l(b,f):a===y?j(b,e):a===z&&l(b,e))}function g(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+y]=c,e[f+z]=d}function h(a,b){for(var c,d,e=a._subscribers,g=a._detail,h=0;h<e.length;h+=3)c=e[h],d=e[h+b],f(b,c,d,g);a._subscribers=null}function i(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(p(b)&&(d=b.then,q(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?j(a,d):k(a,d)))},function(b){return c?!0:(c=!0,void l(a,b))}),!0}catch(e){return c?!0:(l(a,e),!0)}return!1}function j(a,b){a===b?k(a,b):i(a,b)||k(a,b)}function k(a,b){a._state===w&&(a._state=x,a._detail=b,o.async(m,a))}function l(a,b){a._state===w&&(a._state=x,a._detail=b,o.async(n,a))}function m(a){h(a,a._state=y)}function n(a){h(a,a._state=z)}var o=a("./config").config,p=(a("./config").configure,a("./utils").objectOrFunction),q=a("./utils").isFunction,r=(a("./utils").now,a("./all").all),s=a("./race").race,t=a("./resolve").resolve,u=a("./reject").reject,v=a("./asap").asap;o.async=v;var w=void 0,x=0,y=1,z=2;d.prototype={constructor:d,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;o.async(function(){f(c._state,d,e[c._state-1],c._detail)})}else g(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},d.all=r,d.race=s,d.resolve=t,d.reject=u,c.Promise=d},{"./all":2,"./asap":3,"./config":4,"./race":7,"./reject":8,"./resolve":9,"./utils":10}],7:[function(a,b,c){"use strict";function d(a){var b=this;if(!e(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var e=a("./utils").isArray;c.race=d},{"./utils":10}],8:[function(a,b,c){"use strict";function d(a){var b=this;return new b(function(b,c){c(a)})}c.reject=d},{}],9:[function(a,b,c){"use strict";function d(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}c.resolve=d},{}],10:[function(a,b,c){"use strict";function d(a){return e(a)||"object"==typeof a&&null!==a}function e(a){return"function"==typeof a}function f(a){return"[object Array]"===Object.prototype.toString.call(a)}var g=Date.now||function(){return(new Date).getTime()};c.objectOrFunction=d,c.isFunction=e,c.isArray=f,c.now=g},{}],11:[function(a,b){function c(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function d(a){return"function"==typeof a}function e(a){return"number"==typeof a}function f(a){return"object"==typeof a&&null!==a}function g(a){return void 0===a}b.exports=c,c.EventEmitter=c,c.prototype._events=void 0,c.prototype._maxListeners=void 0,c.defaultMaxListeners=10,c.prototype.setMaxListeners=function(a){if(!e(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},c.prototype.emit=function(a){var b,c,e,h,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||f(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],g(c))return!1;if(d(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];c.apply(this,h)}else if(f(c)){for(e=arguments.length,h=new Array(e-1),i=1;e>i;i++)h[i-1]=arguments[i];for(j=c.slice(),e=j.length,i=0;e>i;i++)j[i].apply(this,h)}return!0},c.prototype.addListener=function(a,b){var e;if(!d(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,d(b.listener)?b.listener:b),this._events[a]?f(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,f(this._events[a])&&!this._events[a].warned){var e;e=g(this._maxListeners)?c.defaultMaxListeners:this._maxListeners,e&&e>0&&this._events[a].length>e&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},c.prototype.on=c.prototype.addListener,c.prototype.once=function(a,b){function c(){this.removeListener(a,c),e||(e=!0,b.apply(this,arguments))}if(!d(b))throw TypeError("listener must be a function");var e=!1;return c.listener=b,this.on(a,c),this},c.prototype.removeListener=function(a,b){var c,e,g,h;if(!d(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],g=c.length,e=-1,c===b||d(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(f(c)){for(h=g;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){e=h;break}if(0>e)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(e,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},c.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],d(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},c.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?d(this._events[a])?[this._events[a]]:this._events[a].slice():[]},c.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?d(a._events[b])?1:a._events[b].length:0}},{}],12:[function(a,b){function c(){}var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(){throw new Error("process.chdir is not supported")}},{}],13:[function(a,b){var c;if("undefined"!=typeof b&&"undefined"!=typeof b.exports?b.exports=c={EventEmitter:a("events").EventEmitter,Promise:a("es6-promise").Promise}:"function"==typeof define&&define.amd?define(function(a){a("events"),a("es6-promise");return{EventEmitter:a("events").EventEmitter,Promise:a("es6-promise").Promise}}):window.DeLorean=DeLorean,"undefined"!=typeof DeLorean)for(var d in c)DeLorean.Flux.define(d,c[d])},{"es6-promise":1,events:11}]},{},[13]);
//# sourceMappingURL=delorean.min.js.map

@@ -9,10 +9,6 @@ # Dispatchers

When using the React mixin, you attach a component to a specific
dispatcher's stores by passing the dispatcher instance as the `dispatcher` property
to the top level component in the tree. Delorean will then search up the tree for
dispatchers. This means that any component with the Flux React mixin applied,
that is downstream from a component passed a `dispatcher` prop, will get the
`state` of the dispatcher's stores. Small apps generally only require a single
dispatcher, but it may be desirable to use multiple dispatchers in a larger app,
each responsible for data flows in a different section or module.
When using the React mixin, any component with the Flux React mixin applied, will get the `state` of the dispatcher's stores. In flux, the dispatcher is a singleton, and should be created when the page loads
with `Flux.createDispatcher` before calling `React.render`. Note: you can create multiple dispatchers
with delorean, but as far as the mixin is concerned, the most recently created dispatcher is the one
and only.

@@ -19,0 +15,0 @@ ## `Flux.createDispatcher`

@@ -11,3 +11,3 @@ # Tutorial

<head>
<script src="//rawgit.com/f/delorean/master/dist/delorean.min.js"></script>
<script src="https://cdn.rawgit.com/deloreanjs/delorean/master/dist/delorean.min.js"></script>
</head>

@@ -14,0 +14,0 @@ <body>

@@ -7,4 +7,3 @@ # Views (or Components)

Use the **`Flux.mixins.storeListener`** mixin to get a component into the Flux system.
Also pass `dispatcher={DispatcherName}` attribute to the *main* or *top level* React component. It will
then pass the dispatcher to all the child component to which you have applied the `storeListener` mixin.
All components to which you have applied the `storeListener` mixin will be able to access stores.

@@ -76,3 +75,3 @@ ```js

is an array, defined on your component, containing the names of stores you want the component to watch for changes.
This property is optional, and when omitted, all stores associated with the passed `dispatcher` will be watched.
This property is optional, and when omitted, all stores associated with the `dispatcher` will be watched.
Store name strings should match the keys of the stores returned in the `dispatchers`'s `getStores` method.

@@ -86,3 +85,3 @@

// Only watch the todoStore, omitting this property will watch all stores on passed dispatcher
// Only watch the todoStore, omitting this property will watch all stores on the dispatcher
watchStores: ['todoStore'],

@@ -89,0 +88,0 @@

{
"name": "delorean",
"version": "0.9.3",
"version": "0.9.4",
"description": "Flux Library",

@@ -5,0 +5,0 @@ "main": "src/delorean.js",

@@ -23,6 +23,5 @@ # DeLorean.js

- [Try **React.js** example on JSFiddle](http://jsfiddle.net/fkadev/a2ms7rcc/)
- [Try **Flight.js** example on JSFiddle](http://jsfiddle.net/fkadev/1cw9Leau/)
- [Try **Ractive.js** example on JSFiddle](http://jsfiddle.net/PhilJ/2r1k2k90/2/)
- [Try **React.js** example on JSFiddle](http://jsfiddle.net/smadad/m2r0xo70/3/)
- [Try **Flight.js** example on JSFiddle](http://jsfiddle.net/smadad/hz9nahga/1/)
---

@@ -66,2 +65,3 @@

```javascript
var Flux = DeLorean.Flux;
/*

@@ -80,6 +80,6 @@ * Stores are simple data buckets which manages data.

});
var store = new Store();
var store = Store;
/*
* Dispatchers are simple action dispatchers for stores.
* Dispatcher are simple action dispatchers for stores.
* Stores handle the related action.

@@ -109,3 +109,3 @@ */

// End of data cycle.
document.getElementById('result').innerText = store.store.data;
document.getElementById('result').innerText = store.data;
});

@@ -118,3 +118,3 @@

```
[Run this example on JSFiddle](http://jsfiddle.net/fkadev/40cx3146/)
[Run this example on JSFiddle](http://jsfiddle.net/smadad/tL4mctjd/1/)

@@ -150,6 +150,7 @@ ## Docs

- Darcy Adams [@darcyadams](https://github.com/darcyadams)
- Tim Branyen [@tbranyen](https://github.com/tbranyen)
## Contributors
- Tom Moor [@tommoor](https://github.com/tommoor)
- Tim Branyen [@tbranyen](https://github.com/tbranyen)
- Quang Van [@quangv](https://github.com/quangv)

@@ -191,1 +192,2 @@ - James H. Edwards [@incrediblesound](https://github.com/incrediblesound)

- [https://reactjsnews.com/the-state-of-flux/](https://reactjsnews.com/the-state-of-flux/)
- [http://facebook.github.io/react/blog/2014/10/17/community-roundup-23.html](http://facebook.github.io/react/blog/2014/10/17/community-roundup-23.html)

@@ -35,12 +35,7 @@ (function (DeLorean) {

function __findDispatcher(view) {
// Provide a useful error message if no dispatcher is found in the chain
if (view == null) {
throw 'No dispatcher found. The DeLoreanJS mixin requires a "dispatcher" property to be passed to a component, or one of it\'s ancestors.';
// Provide a useful error message if no dispatcher is found
if (DeLorean.dispatcher == null) {
throw 'No dispatcher found. The DeLoreanJS mixin requires a "dispatcher" has been created using Flux.createDispatcher.';
}
/* `view` should be a component instance. If a component don't have
any dispatcher, it tries to find a dispatcher from the parents. */
if (!view.props.dispatcher) {
return __findDispatcher(view._owner);
}
return view.props.dispatcher;
return DeLorean.dispatcher;
}

@@ -117,5 +112,5 @@

args = Array.prototype.slice.call(arguments);
this.listener.emit.apply(this.listener, ['dispatch'].concat(args));
/* Stores are key-value pairs. Collect store instances into an array. */

@@ -541,2 +536,12 @@ stores = (function () {

// Allow only a single dispatcher
if (DeLorean.dispatcher != null) {
if (console != null) {
console.warn('You are attempting to create more than one dispatcher. DeLorean is intended to be used with a single dispatcher. This latest dispatcher created will overwrite any previous versions.');
}
}
// Create an internal reference to the dispathcer instance. This allows it to be found by the mixins.
DeLorean.dispatcher = dispatcher;
return dispatcher;

@@ -659,2 +664,9 @@ },

getStore: function (storeName) {
if (console != null && typeof this.__watchStores[storeName] === 'undefined') {
var message;
message = 'Attempt to getStore ' + storeName + ' failed. ';
message += typeof this.stores[storeName] === 'undefined' ? 'It is not defined on the dispatcher. ' : 'It is not being watched by the component. ';
message += this.constructor != null && this.constructor.displayName != null ? 'Check the ' + this.constructor.displayName + ' component.' : '';
console.warn(message);
}
return this.state.stores[storeName];

@@ -661,0 +673,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc