Comparing version 6.3.0 to 6.4.1
{ | ||
"name": "reflux", | ||
"version": "6.3.0", | ||
"version": "6.4.1", | ||
"homepage": "https://github.com/spoike/reflux", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -7,2 +7,13 @@ # Changelog | ||
## v6.4.1 | ||
* NOTE: New `MyStore.state` shortcut (from 6.4.0) is not available in IE10 and below, use accordingly in your projects. | ||
* Remove test for it so that it doesn't fail, and is undocumented feature for now, until the day we can drop IE9 and IE10. | ||
## v6.4.0 | ||
* Improved on class extending function used internally. | ||
* Made that extending function available externally at `Reflux.utils.inherits(NewClass, InheritsFrom)` so that it can be used for testing. | ||
* Made `MyStore.state` work as shortcut access to `MyStore.singleton.state` (not available in IE9 and IE10, plan usage accordingly for your project). | ||
## v6.3.0 | ||
@@ -9,0 +20,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Reflux=a()}}(function(){return 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);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.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";function d(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function e(){}var f=Object.prototype.hasOwnProperty,g="function"!=typeof Object.create?"~":!1;e.prototype._events=void 0,e.prototype.eventNames=function(){var a,b=this._events,c=[];if(!b)return c;for(a in b)f.call(b,a)&&c.push(g?a.slice(1):a);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(b)):c},e.prototype.listeners=function(a,b){var c=g?g+a:a,d=this._events&&this._events[c];if(b)return!!d;if(!d)return[];if(d.fn)return[d.fn];for(var e=0,f=d.length,h=new Array(f);f>e;e++)h[e]=d[e].fn;return h},e.prototype.emit=function(a,b,c,d,e,f){var h=g?g+a:a;if(!this._events||!this._events[h])return!1;var i,j,k=this._events[h],l=arguments.length;if("function"==typeof k.fn){switch(k.once&&this.removeListener(a,k.fn,void 0,!0),l){case 1:return k.fn.call(k.context),!0;case 2:return k.fn.call(k.context,b),!0;case 3:return k.fn.call(k.context,b,c),!0;case 4:return k.fn.call(k.context,b,c,d),!0;case 5:return k.fn.call(k.context,b,c,d,e),!0;case 6:return k.fn.call(k.context,b,c,d,e,f),!0}for(j=1,i=new Array(l-1);l>j;j++)i[j-1]=arguments[j];k.fn.apply(k.context,i)}else{var m,n=k.length;for(j=0;n>j;j++)switch(k[j].once&&this.removeListener(a,k[j].fn,void 0,!0),l){case 1:k[j].fn.call(k[j].context);break;case 2:k[j].fn.call(k[j].context,b);break;case 3:k[j].fn.call(k[j].context,b,c);break;default:if(!i)for(m=1,i=new Array(l-1);l>m;m++)i[m-1]=arguments[m];k[j].fn.apply(k[j].context,i)}}return!0},e.prototype.on=function(a,b,c){var e=new d(b,c||this),f=g?g+a:a;return this._events||(this._events=g?{}:Object.create(null)),this._events[f]?this._events[f].fn?this._events[f]=[this._events[f],e]:this._events[f].push(e):this._events[f]=e,this},e.prototype.once=function(a,b,c){var e=new d(b,c||this,!0),f=g?g+a:a;return this._events||(this._events=g?{}:Object.create(null)),this._events[f]?this._events[f].fn?this._events[f]=[this._events[f],e]:this._events[f].push(e):this._events[f]=e,this},e.prototype.removeListener=function(a,b,c,d){var e=g?g+a:a;if(!this._events||!this._events[e])return this;var f=this._events[e],h=[];if(b)if(f.fn)(f.fn!==b||d&&!f.once||c&&f.context!==c)&&h.push(f);else for(var i=0,j=f.length;j>i;i++)(f[i].fn!==b||d&&!f[i].once||c&&f[i].context!==c)&&h.push(f[i]);return h.length?this._events[e]=1===h.length?h[0]:h:delete this._events[e],this},e.prototype.removeAllListeners=function(a){return this._events?(a?delete this._events[g?g+a:a]:this._events=g?{}:Object.create(null),this):this},e.prototype.off=e.prototype.removeListener,e.prototype.addListener=e.prototype.on,e.prototype.setMaxListeners=function(){return this},e.prefixed=g,"undefined"!=typeof b&&(b.exports=e)},{}],2:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0})},{}],3:[function(a,b,c){"use strict";function d(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!0;h=a}function e(a){h&&i.push(a)}function f(a){h&&j.push(a)}function g(){for(;i.length;)i.pop();for(;j.length;)j.pop()}Object.defineProperty(c,"__esModule",{value:!0});var h=!1,i=[],j=[];c.useKeep=d,c.addStore=e,c.addAction=f,c.createdStores=i,c.createdActions=j,c.reset=g},{}],4:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}Object.defineProperty(c,"__esModule",{value:!0}),c.joinStrict=c.joinConcat=c.joinLeading=c.joinTrailing=c.fetchInitialState=c.stopListeningToAll=c.stopListeningTo=c.listenTo=c.validateListening=c.listenToMany=c.hasListener=void 0;var e=a("./utils"),f=d(e),g=a("./joins"),h=function(a){for(var b,c=0,d={};c<(a.children||[]).length;++c)b=a.children[c],a[b]&&(d[b]=a[b]);return d},i=function j(a){var b={};for(var c in a){var d=a[c],e=h(d),g=j(e);b[c]=d;for(var i in g){var k=g[i];b[c+f.capitalize(i)]=k}}return b};c.hasListener=function(a){for(var b,c,d,e=0;e<(this.subscriptions||[]).length;++e)for(d=[].concat(this.subscriptions[e].listenable),b=0;b<d.length;b++)if(c=d[b],c===a||c.hasListener&&c.hasListener(a))return!0;return!1},c.listenToMany=function(a){var b=i(a);for(var c in b){var d=f.callbackName(c),e=this[d]?d:this[c]?c:void 0;e&&this.listenTo(b[c],e,this[d+"Default"]||this[e+"Default"]||e)}},c.validateListening=function(a){return a===this?"Listener is not able to listen to itself":f.isFunction(a.listen)?a.hasListener&&a.hasListener(this)?"Listener cannot listen to this listenable because of circular loop":void 0:a+" is missing a listen method"},c.listenTo=function(a,b,c){var d,e,g,h=this.subscriptions=this.subscriptions||[];return f.throwIf(this.validateListening(a)),this.fetchInitialState(a,c),d=a.listen(this[b]||b,this),e=function(){var a=h.indexOf(g);f.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),d()},g={stop:e,listenable:a},h.push(g),g},c.stopListeningTo=function(a){for(var b,c=0,d=this.subscriptions||[];c<d.length;c++)if(b=d[c],b.listenable===a)return b.stop(),f.throwIf(-1!==d.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},c.stopListeningToAll=function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),f.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},c.fetchInitialState=function(a,b){b=b&&this[b]||b;var c=this;if(f.isFunction(b)&&f.isFunction(a.getInitialState)){var d=a.getInitialState();d&&f.isFunction(d.then)?d.then(function(){b.apply(c,arguments)}):b.call(this,d)}},c.joinTrailing=(0,g.instanceJoinCreator)("last"),c.joinLeading=(0,g.instanceJoinCreator)("first"),c.joinConcat=(0,g.instanceJoinCreator)("all"),c.joinStrict=(0,g.instanceJoinCreator)("strict")},{"./joins":11,"./utils":13}],5:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}Object.defineProperty(c,"__esModule",{value:!0}),c.deferWith=c.triggerAsync=c.trigger=c.listen=c.shouldEmit=c.preEmit=void 0;var e=a("./utils"),f=d(e);c.preEmit=function(){},c.shouldEmit=function(){return!0},c.listen=function(a,b){b=b||this;var c=function(c){e||a.apply(b,c)},d=this,e=!1;return this.emitter.addListener(this.eventLabel,c),function(){e=!0,d.emitter.removeListener(d.eventLabel,c)}},c.trigger=function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:f.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},c.triggerAsync=function(){var a=arguments,b=this;f.nextTick(function(){b.trigger.apply(b,a)})},c.deferWith=function(a){var b=this.trigger,c=this,d=function(){b.apply(c,arguments)};this.trigger=function(){a.apply(c,[d].concat([].splice.call(arguments,0)))}}},{"./utils":13}],6:[function(a,b,c){arguments[4][2][0].apply(c,arguments)},{dup:2}],7:[function(a,b,c){"use strict";function d(a,b){for(var c in b)if(Object.getOwnPropertyDescriptor&&Object.defineProperty){var d=Object.getOwnPropertyDescriptor(b,c);if(!d.value||"function"!=typeof d.value||!b.hasOwnProperty(c))continue;a[c]=b[c].bind(a)}else{var e=b[c];if("function"!=typeof e||!b.hasOwnProperty(c))continue;a[c]=e.bind(a)}return a}Object.defineProperty(c,"__esModule",{value:!0}),c.bindMethods=d},{}],8:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){a=a||{},g.isObject(a)||(a={actionName:a});for(var b in i)if(!n[b]&&k[b])throw new Error("Cannot override API method "+b+" in Reflux.ActionMethods. Use another method name or override it on Reflux.PublisherMethods instead.");for(var c in a)if(!n[c]&&k[c])throw new Error("Cannot override API method "+c+" in action creation. Use another method name or override it on Reflux.PublisherMethods instead.");a.children=a.children||[],a.asyncResult&&(a.children=a.children.concat(["completed","failed"]));for(var d=0,f={};d<a.children.length;d++){var h=a.children[d],j="string"==typeof h?h:h.actionName;f[j]=e(h)}var l=g.extend({eventLabel:"action",emitter:new g.EventEmitter,_isAction:!0},k,i,a),o=function p(){var a=!1;for(var b in p.childActions){a=!0;break}var c=!p.sync&&"undefined"!=typeof p.sync||a,d=c?"triggerAsync":"trigger";return p[d].apply(p,arguments)};return g.extend(o,f,l),m.addAction(o),o}Object.defineProperty(c,"__esModule",{value:!0}),c.createAction=e;var f=a("./utils"),g=d(f),h=a("./ActionMethods"),i=d(h),j=a("./PublisherMethods"),k=d(j),l=a("./Keep"),m=d(l),n={preEmit:1,shouldEmit:1}},{"./ActionMethods":2,"./Keep":3,"./PublisherMethods":5,"./utils":13}],9:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){function b(){var b,c=0;if(this.subscriptions=[],this.emitter=new g.EventEmitter,this.eventLabel="change",(0,k.bindMethods)(this,a),this.init&&g.isFunction(this.init)&&this.init(),this.listenables)for(b=[].concat(this.listenables);c<b.length;c++)this.listenToMany(b[c])}a=a||{};for(var c in m)if(!r[c]&&(o[c]||q[c]))throw new Error("Cannot override API method "+c+" in Reflux.StoreMethods. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");for(var d in a)if(!r[d]&&(o[d]||q[d]))throw new Error("Cannot override API method "+d+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");a=(0,j.mix)(a),g.extend(b.prototype,q,o,m,a);var e=new b;return i.addStore(e),e}Object.defineProperty(c,"__esModule",{value:!0}),c.createStore=e;var f=a("./utils"),g=d(f),h=a("./Keep"),i=d(h),j=a("./mixer"),k=a("./bindMethods"),l=a("./StoreMethods"),m=d(l),n=a("./PublisherMethods"),o=d(n),p=a("./ListenerMethods"),q=d(p),r={preEmit:1,shouldEmit:1}},{"./Keep":3,"./ListenerMethods":4,"./PublisherMethods":5,"./StoreMethods":6,"./bindMethods":7,"./mixer":12,"./utils":13}],10:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){r.EventEmitter=a}function f(a){r.nextTick=a}function g(a){a(this)}Object.defineProperty(c,"__esModule",{value:!0}),c.__keep=c.joinConcat=c.joinStrict=c.joinLeading=c.all=c.joinTrailing=c.use=c.nextTick=c.setEventEmitter=c.createActions=c.createStore=c.createAction=c.utils=c.StoreMethods=c.PublisherMethods=c.ListenerMethods=c.ActionMethods=c.version=void 0;var h=a("./ActionMethods"),i=d(h),j=a("./ListenerMethods"),k=d(j),l=a("./PublisherMethods"),m=d(l),n=a("./StoreMethods"),o=d(n),p=a("./joins"),q=a("./utils"),r=d(q),s=a("./createAction"),t=a("./createStore"),u=a("./Keep"),v=d(u),w={"reflux-core":"1.0.0"},x=(0,p.staticJoinCreator)("last"),y=x,z=(0,p.staticJoinCreator)("first"),A=(0,p.staticJoinCreator)("strict"),B=(0,p.staticJoinCreator)("all"),C=r,D=function(){var a=function(a,b){Object.keys(a).forEach(function(c){var d=a[c];b[c]=(0,s.createAction)(d)})};return function(b){var c={};return b instanceof Array?b.forEach(function(b){r.isObject(b)?a(b,c):c[b]=(0,s.createAction)(b)}):a(b,c),c}}();c.version=w,c.ActionMethods=i,c.ListenerMethods=k,c.PublisherMethods=m,c.StoreMethods=o,c.utils=C,c.createAction=s.createAction,c.createStore=t.createStore,c.createActions=D,c.setEventEmitter=e,c.nextTick=f,c.use=g,c.joinTrailing=x,c.all=y,c.joinLeading=z,c.joinStrict=A,c.joinConcat=B,c.__keep=v,Object.defineProperty(c,"default",{get:function(){return c}}),Function.prototype.bind||console.error("Function.prototype.bind not available. ES5 shim required. https://github.com/spoike/refluxjs#es5")},{"./ActionMethods":2,"./Keep":3,"./ListenerMethods":4,"./PublisherMethods":5,"./StoreMethods":6,"./createAction":8,"./createStore":9,"./joins":11,"./utils":13}],11:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){return function(){var b=n.call(arguments);return(0,k.createStore)({init:function(){this[o[a]].apply(this,b.concat("triggerAsync"))}})}}function f(a){return function(){m.throwIf(arguments.length<2,"Cannot create a join with less than 2 listenables!");var b,c,d=n.call(arguments),e=d.pop(),f=d.length,j={numberOfListenables:f,callback:this[e]||e,listener:this,strategy:a},k=[];for(b=0;f>b;b++)m.throwIf(this.validateListening(d[b]));for(b=0;f>b;b++)k.push(d[b].listen(i(b,j),this));return h(j),c={listenable:d},c.stop=g(c,k,this),this.subscriptions=(this.subscriptions||[]).concat(c),c}}function g(a,b,c){return function(){var d,e=c.subscriptions,f=e?e.indexOf(a):-1;for(m.throwIf(-1===f,"Tried to remove join already gone from subscriptions list!"),d=0;d<b.length;d++)b[d]();e.splice(f,1)}}function h(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function i(a,b){return function(){var c=n.call(arguments);if(b.listenablesEmitted[a])switch(b.strategy){case"strict":throw new Error("Strict join failed because listener triggered twice.");case"last":b.args[a]=c;break;case"all":b.args[a].push(c)}else b.listenablesEmitted[a]=!0,b.args[a]="all"===b.strategy?[c]:c;j(b)}}function j(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),h(a)}Object.defineProperty(c,"__esModule",{value:!0}),c.staticJoinCreator=e,c.instanceJoinCreator=f;var k=a("./createStore"),l=a("./utils"),m=d(l),n=Array.prototype.slice,o={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"}},{"./createStore":9,"./utils":13}],12:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){var b={init:[],preEmit:[],shouldEmit:[]},c=function d(a){var c={};return a.mixins&&a.mixins.forEach(function(a){g.extend(c,d(a))}),g.extend(c,a),Object.keys(b).forEach(function(c){a.hasOwnProperty(c)&&b[c].push(a[c])}),c}(a);return b.init.length>1&&(c.init=function(){var a=arguments;b.init.forEach(function(b){b.apply(this,a)},this)}),b.preEmit.length>1&&(c.preEmit=function(){return b.preEmit.reduce(function(a,b){var c=b.apply(this,a);return void 0===c?a:[c]}.bind(this),arguments)}),b.shouldEmit.length>1&&(c.shouldEmit=function(){var a=arguments;return!b.shouldEmit.some(function(b){return!b.apply(this,a)},this)}),Object.keys(b).forEach(function(a){1===b[a].length&&(c[a]=b[a][0])}),c}Object.defineProperty(c,"__esModule",{value:!0}),c.mix=e;var f=a("./utils"),g=d(f)},{"./utils":13}],13:[function(a,b,c){"use strict";function d(a){return a.charAt(0).toUpperCase()+a.slice(1)}function e(a,b){return b=b||"on",b+c.capitalize(a)}function f(a){var b="undefined"==typeof a?"undefined":m(a);return"function"===b||"object"===b&&!!a}function g(a){if(!f(a))return a;for(var b,c,d,e=1,g=arguments.length;g>e;e++){b=arguments[e],c=Object.keys(b);for(var h=0;h<c.length;h++)if(d=c[h],Object.getOwnPropertyDescriptor&&Object.defineProperty){var i=Object.getOwnPropertyDescriptor(b,d);Object.defineProperty(a,d,i)}else a[d]=b[d]}return a}function h(a){return"function"==typeof a}function i(a){setTimeout(a,0)}function j(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c}function k(a){return"object"===("undefined"==typeof a?"undefined":m(a))&&"callee"in a&&"number"==typeof a.length}function l(a,b){if(a)throw Error(b||a)}Object.defineProperty(c,"__esModule",{value:!0});var m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};c.capitalize=d,c.callbackName=e,c.isObject=f,c.extend=g,c.isFunction=h,c.nextTick=i,c.object=j,c.isArguments=k,c.throwIf=l,c.EventEmitter=a("eventemitter3")},{eventemitter3:1}],14:[function(a,b,c){var d=a("reflux-core/lib/utils"),e=a("reflux-core/lib/ListenerMethods");b.exports=d.extend({componentWillUnmount:e.stopListeningToAll},e)},{"reflux-core/lib/ListenerMethods":4,"reflux-core/lib/utils":13}],15:[function(a,b,c){var d=a("reflux-core");if(d.defineReact=a("./defineReact"),"undefined"!=typeof React&&React)d.defineReact(React);else try{var e=a("react");d.defineReact(e)}catch(f){}},{"./defineReact":18,react:void 0,"reflux-core":10}],16:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods"),e=a("./ListenerMixin"),f=a("reflux-core/lib/utils");b.exports=function(a,b){return f.throwIf("undefined"==typeof b,"Reflux.connect() requires a key."),{getInitialState:function(){return f.isFunction(a.getInitialState)?f.object([b],[a.getInitialState()]):{}},componentDidMount:function(){var c=this;f.extend(c,d),this.listenTo(a,function(a){c.setState(f.object([b],[a]))})},componentWillUnmount:e.componentWillUnmount}}},{"./ListenerMixin":14,"reflux-core/lib/ListenerMethods":4,"reflux-core/lib/utils":13}],17:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods"),e=a("./ListenerMixin"),f=a("reflux-core/lib/utils");b.exports=function(a,b,c){return f.throwIf(f.isFunction(b),"Reflux.connectFilter() requires a key."),{getInitialState:function(){if(!f.isFunction(a.getInitialState))return{};var d=c.call(this,a.getInitialState());return"undefined"!=typeof d?f.object([b],[d]):{}},componentDidMount:function(){var e=this;f.extend(this,d),this.listenTo(a,function(a){var d=c.call(e,a);e.setState(f.object([b],[d]))})},componentWillUnmount:e.componentWillUnmount}}},{"./ListenerMixin":14,"reflux-core/lib/ListenerMethods":4,"reflux-core/lib/utils":13}],18:[function(a,b,c){function d(a,b,c){var k,l;try{h=a||h||React,l=c||h.Component}catch(m){return}if(h&&l&&(!j||c)){var n=function(a,b,c){l.call(this,a,b,c)};if(f(n,l),k=n.prototype,k.storeKeys=null,k.componentWillMount=function(){if(this.store&&(Array.isArray(this.stores)?this.stores.unshift(this.store):this.stores=[this.store]),this.stores){this.__storeunsubscribes__=this.__storeunsubscribes__||[];for(var a=this.setState.bind(this),b=function(b){var c=e(this.storeKeys,b);c&&a(c)}.bind(this),c=0,d=this.stores.length;d>c;c++){var f=this.stores[c];if("function"==typeof f){var g=f.id;if(f.singleton||(f.singleton=new f,g&&(i.stores[g]=f.singleton)),this.stores[c]=f=f.singleton,f.id=g,g&&i.GlobalState[g]){for(var h in i.GlobalState[g])f.state[h]=i.GlobalState[g][h];i.GlobalState[g]=f.state}else g&&(i.GlobalState[g]=f.state)}i.serverMode||this.__storeunsubscribes__.push(f.listen(b));var j=e(this.storeKeys,f.state);j&&this.setState(j)}}this.__readytomap__=!0;var k=this.__delayedmaps__;if(k)for(var l=0,m=k.length;m>l;l++)k[l].func(k[l].state);this.__delayedmaps__=null},k.componentWillUnmount=function(){if(this.__storeunsubscribes__)for(var a=0,b=this.__storeunsubscribes__.length;b>a;a++)this.__storeunsubscribes__[a]();this.__readytomap__=!1},k.mapStoreToState=function(a,b){function c(a){var c=b.call(d,a);if(c){var e=!1;for(var f in c){e=!0;break}e&&d.setState(c)}}"function"==typeof a&&(a=a.singleton?a.singleton:i.initStore(a));var d=this;this.__storeunsubscribes__=this.__storeunsubscribes__||[],this.__storeunsubscribes__.push(a.listen(c)),this.__readytomap__?c(a.state):(this.__delayedmaps__=this.__delayedmaps__||[],this.__delayedmaps__.push({func:c,state:a.state}))},n.extend=function(a){return d(null,null,a)},c)return n;i.Component=n,h.PureComponent&&(i.PureComponent=n.extend(h.PureComponent));var o=function(){this.__store__=i.createStore(),this.state={};var a=this;for(var b in this.__store__)!function(b){Object.defineProperty(a,b,{get:function(){return a.__store__[b]},set:function(c){a.__store__[b]=c}})}(b)};k=o.prototype,Object.defineProperty(k,"listenables",{get:function(){return this.__listenables__},set:function(a){var b={};Array.isArray(a)?a.forEach(function(a){for(var c in a)b[c]=a[c]}):b=a,this.__listenables__=b,this.listenToMany(b)},enumerable:!0,configurable:!0}),k.setState=function(a){for(var b in a)this.state[b]=a[b];this.id&&(i.GlobalState[this.id]=this.state),this.trigger(a)},Object.defineProperty(o,"isES6Store",{get:function(){return!0},enumerable:!0,configurable:!0}),i.Store=o,i.GlobalState=i.GlobalState||{},i.stores={},i.getGlobalState=function(){return g(i.GlobalState)},i.setGlobalState=function(a){for(var b in a)i.stores[b]?i.stores[b].setState(a[b]):i.GlobalState[b]=a[b]},i.initializeGlobalStore=i.initStore=function(a){var b=a.id;if(a.singleton)return a.singleton;if(!b)return a.singleton=new a,a.singleton;var c=a.singleton=new a;if(i.stores[b]=c,c.id=b,i.GlobalState[b]){for(var d in i.GlobalState[b])c.state[d]=i.GlobalState[b][d];i.GlobalState[b]=c.state}else i.GlobalState[b]=c.state;return c},j=!0}}function e(a,b){if(!a)return b;for(var c=!1,d={},e=0,f=a.length;f>e;e++){var g=a[e];b.hasOwnProperty(g)&&(c=!0,d[g]=b[g])}return c?d:!1}function f(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)}function g(a,b){if(null===a||"object"!=typeof a)return a;if(a.constructor!==Object&&a.constructor!==Array)return a;if(a.constructor===Date||a.constructor===RegExp||a.constructor===Function||a.constructor===String||a.constructor===Number||a.constructor===Boolean)return new a.constructor(a);b=b||new a.constructor;for(var c in a)b[c]="undefined"==typeof b[c]?g(a[c],null):b[c];return b}var h,i=a("reflux-core"),j=!1;b.exports=d},{"reflux-core":10}],19:[function(a,b,c){var d=a("reflux-core");d.serverMode="object"!=typeof window,d.connect=a("./connect"),d.connectFilter=a("./connectFilter"),d.ListenerMixin=a("./ListenerMixin"),d.listenTo=a("./listenTo"),d.listenToMany=a("./listenToMany"),a("./addES6"),b.exports=d},{"./ListenerMixin":14,"./addES6":15,"./connect":16,"./connectFilter":17,"./listenTo":20,"./listenToMany":21,"reflux-core":10}],20:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods");b.exports=function(a,b,c){return{componentDidMount:function(){for(var e in d)if(this[e]!==d[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=d[e]}this.listenTo(a,b,c)},componentWillUnmount:d.stopListeningToAll}}},{"reflux-core/lib/ListenerMethods":4}],21:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods");b.exports=function(a){return{componentDidMount:function(){for(var b in d)if(this[b]!==d[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=d[b]}this.listenToMany(a)},componentWillUnmount:d.stopListeningToAll}}},{"reflux-core/lib/ListenerMethods":4}]},{},[19])(19)}); | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Reflux=a()}}(function(){return 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);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.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";function d(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function e(){}var f=Object.prototype.hasOwnProperty,g="function"!=typeof Object.create?"~":!1;e.prototype._events=void 0,e.prototype.eventNames=function(){var a,b=this._events,c=[];if(!b)return c;for(a in b)f.call(b,a)&&c.push(g?a.slice(1):a);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(b)):c},e.prototype.listeners=function(a,b){var c=g?g+a:a,d=this._events&&this._events[c];if(b)return!!d;if(!d)return[];if(d.fn)return[d.fn];for(var e=0,f=d.length,h=new Array(f);f>e;e++)h[e]=d[e].fn;return h},e.prototype.emit=function(a,b,c,d,e,f){var h=g?g+a:a;if(!this._events||!this._events[h])return!1;var i,j,k=this._events[h],l=arguments.length;if("function"==typeof k.fn){switch(k.once&&this.removeListener(a,k.fn,void 0,!0),l){case 1:return k.fn.call(k.context),!0;case 2:return k.fn.call(k.context,b),!0;case 3:return k.fn.call(k.context,b,c),!0;case 4:return k.fn.call(k.context,b,c,d),!0;case 5:return k.fn.call(k.context,b,c,d,e),!0;case 6:return k.fn.call(k.context,b,c,d,e,f),!0}for(j=1,i=new Array(l-1);l>j;j++)i[j-1]=arguments[j];k.fn.apply(k.context,i)}else{var m,n=k.length;for(j=0;n>j;j++)switch(k[j].once&&this.removeListener(a,k[j].fn,void 0,!0),l){case 1:k[j].fn.call(k[j].context);break;case 2:k[j].fn.call(k[j].context,b);break;case 3:k[j].fn.call(k[j].context,b,c);break;default:if(!i)for(m=1,i=new Array(l-1);l>m;m++)i[m-1]=arguments[m];k[j].fn.apply(k[j].context,i)}}return!0},e.prototype.on=function(a,b,c){var e=new d(b,c||this),f=g?g+a:a;return this._events||(this._events=g?{}:Object.create(null)),this._events[f]?this._events[f].fn?this._events[f]=[this._events[f],e]:this._events[f].push(e):this._events[f]=e,this},e.prototype.once=function(a,b,c){var e=new d(b,c||this,!0),f=g?g+a:a;return this._events||(this._events=g?{}:Object.create(null)),this._events[f]?this._events[f].fn?this._events[f]=[this._events[f],e]:this._events[f].push(e):this._events[f]=e,this},e.prototype.removeListener=function(a,b,c,d){var e=g?g+a:a;if(!this._events||!this._events[e])return this;var f=this._events[e],h=[];if(b)if(f.fn)(f.fn!==b||d&&!f.once||c&&f.context!==c)&&h.push(f);else for(var i=0,j=f.length;j>i;i++)(f[i].fn!==b||d&&!f[i].once||c&&f[i].context!==c)&&h.push(f[i]);return h.length?this._events[e]=1===h.length?h[0]:h:delete this._events[e],this},e.prototype.removeAllListeners=function(a){return this._events?(a?delete this._events[g?g+a:a]:this._events=g?{}:Object.create(null),this):this},e.prototype.off=e.prototype.removeListener,e.prototype.addListener=e.prototype.on,e.prototype.setMaxListeners=function(){return this},e.prefixed=g,"undefined"!=typeof b&&(b.exports=e)},{}],2:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0})},{}],3:[function(a,b,c){"use strict";function d(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!0;h=a}function e(a){h&&i.push(a)}function f(a){h&&j.push(a)}function g(){for(;i.length;)i.pop();for(;j.length;)j.pop()}Object.defineProperty(c,"__esModule",{value:!0});var h=!1,i=[],j=[];c.useKeep=d,c.addStore=e,c.addAction=f,c.createdStores=i,c.createdActions=j,c.reset=g},{}],4:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}Object.defineProperty(c,"__esModule",{value:!0}),c.joinStrict=c.joinConcat=c.joinLeading=c.joinTrailing=c.fetchInitialState=c.stopListeningToAll=c.stopListeningTo=c.listenTo=c.validateListening=c.listenToMany=c.hasListener=void 0;var e=a("./utils"),f=d(e),g=a("./joins"),h=function(a){for(var b,c=0,d={};c<(a.children||[]).length;++c)b=a.children[c],a[b]&&(d[b]=a[b]);return d},i=function j(a){var b={};for(var c in a){var d=a[c],e=h(d),g=j(e);b[c]=d;for(var i in g){var k=g[i];b[c+f.capitalize(i)]=k}}return b};c.hasListener=function(a){for(var b,c,d,e=0;e<(this.subscriptions||[]).length;++e)for(d=[].concat(this.subscriptions[e].listenable),b=0;b<d.length;b++)if(c=d[b],c===a||c.hasListener&&c.hasListener(a))return!0;return!1},c.listenToMany=function(a){var b=i(a);for(var c in b){var d=f.callbackName(c),e=this[d]?d:this[c]?c:void 0;e&&this.listenTo(b[c],e,this[d+"Default"]||this[e+"Default"]||e)}},c.validateListening=function(a){return a===this?"Listener is not able to listen to itself":f.isFunction(a.listen)?a.hasListener&&a.hasListener(this)?"Listener cannot listen to this listenable because of circular loop":void 0:a+" is missing a listen method"},c.listenTo=function(a,b,c){var d,e,g,h=this.subscriptions=this.subscriptions||[];return f.throwIf(this.validateListening(a)),this.fetchInitialState(a,c),d=a.listen(this[b]||b,this),e=function(){var a=h.indexOf(g);f.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),d()},g={stop:e,listenable:a},h.push(g),g},c.stopListeningTo=function(a){for(var b,c=0,d=this.subscriptions||[];c<d.length;c++)if(b=d[c],b.listenable===a)return b.stop(),f.throwIf(-1!==d.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},c.stopListeningToAll=function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),f.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},c.fetchInitialState=function(a,b){b=b&&this[b]||b;var c=this;if(f.isFunction(b)&&f.isFunction(a.getInitialState)){var d=a.getInitialState();d&&f.isFunction(d.then)?d.then(function(){b.apply(c,arguments)}):b.call(this,d)}},c.joinTrailing=(0,g.instanceJoinCreator)("last"),c.joinLeading=(0,g.instanceJoinCreator)("first"),c.joinConcat=(0,g.instanceJoinCreator)("all"),c.joinStrict=(0,g.instanceJoinCreator)("strict")},{"./joins":11,"./utils":13}],5:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}Object.defineProperty(c,"__esModule",{value:!0}),c.deferWith=c.triggerAsync=c.trigger=c.listen=c.shouldEmit=c.preEmit=void 0;var e=a("./utils"),f=d(e);c.preEmit=function(){},c.shouldEmit=function(){return!0},c.listen=function(a,b){b=b||this;var c=function(c){e||a.apply(b,c)},d=this,e=!1;return this.emitter.addListener(this.eventLabel,c),function(){e=!0,d.emitter.removeListener(d.eventLabel,c)}},c.trigger=function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:f.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},c.triggerAsync=function(){var a=arguments,b=this;f.nextTick(function(){b.trigger.apply(b,a)})},c.deferWith=function(a){var b=this.trigger,c=this,d=function(){b.apply(c,arguments)};this.trigger=function(){a.apply(c,[d].concat([].splice.call(arguments,0)))}}},{"./utils":13}],6:[function(a,b,c){arguments[4][2][0].apply(c,arguments)},{dup:2}],7:[function(a,b,c){"use strict";function d(a,b){for(var c in b)if(Object.getOwnPropertyDescriptor&&Object.defineProperty){var d=Object.getOwnPropertyDescriptor(b,c);if(!d.value||"function"!=typeof d.value||!b.hasOwnProperty(c))continue;a[c]=b[c].bind(a)}else{var e=b[c];if("function"!=typeof e||!b.hasOwnProperty(c))continue;a[c]=e.bind(a)}return a}Object.defineProperty(c,"__esModule",{value:!0}),c.bindMethods=d},{}],8:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){a=a||{},g.isObject(a)||(a={actionName:a});for(var b in i)if(!n[b]&&k[b])throw new Error("Cannot override API method "+b+" in Reflux.ActionMethods. Use another method name or override it on Reflux.PublisherMethods instead.");for(var c in a)if(!n[c]&&k[c])throw new Error("Cannot override API method "+c+" in action creation. Use another method name or override it on Reflux.PublisherMethods instead.");a.children=a.children||[],a.asyncResult&&(a.children=a.children.concat(["completed","failed"]));for(var d=0,f={};d<a.children.length;d++){var h=a.children[d],j="string"==typeof h?h:h.actionName;f[j]=e(h)}var l=g.extend({eventLabel:"action",emitter:new g.EventEmitter,_isAction:!0},k,i,a),o=function p(){var a=!1;for(var b in p.childActions){a=!0;break}var c=!p.sync&&"undefined"!=typeof p.sync||a,d=c?"triggerAsync":"trigger";return p[d].apply(p,arguments)};return g.extend(o,f,l),m.addAction(o),o}Object.defineProperty(c,"__esModule",{value:!0}),c.createAction=e;var f=a("./utils"),g=d(f),h=a("./ActionMethods"),i=d(h),j=a("./PublisherMethods"),k=d(j),l=a("./Keep"),m=d(l),n={preEmit:1,shouldEmit:1}},{"./ActionMethods":2,"./Keep":3,"./PublisherMethods":5,"./utils":13}],9:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){function b(){var b,c=0;if(this.subscriptions=[],this.emitter=new g.EventEmitter,this.eventLabel="change",(0,k.bindMethods)(this,a),this.init&&g.isFunction(this.init)&&this.init(),this.listenables)for(b=[].concat(this.listenables);c<b.length;c++)this.listenToMany(b[c])}a=a||{};for(var c in m)if(!r[c]&&(o[c]||q[c]))throw new Error("Cannot override API method "+c+" in Reflux.StoreMethods. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");for(var d in a)if(!r[d]&&(o[d]||q[d]))throw new Error("Cannot override API method "+d+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");a=(0,j.mix)(a),g.extend(b.prototype,q,o,m,a);var e=new b;return i.addStore(e),e}Object.defineProperty(c,"__esModule",{value:!0}),c.createStore=e;var f=a("./utils"),g=d(f),h=a("./Keep"),i=d(h),j=a("./mixer"),k=a("./bindMethods"),l=a("./StoreMethods"),m=d(l),n=a("./PublisherMethods"),o=d(n),p=a("./ListenerMethods"),q=d(p),r={preEmit:1,shouldEmit:1}},{"./Keep":3,"./ListenerMethods":4,"./PublisherMethods":5,"./StoreMethods":6,"./bindMethods":7,"./mixer":12,"./utils":13}],10:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){r.EventEmitter=a}function f(a){r.nextTick=a}function g(a){a(this)}Object.defineProperty(c,"__esModule",{value:!0}),c.__keep=c.joinConcat=c.joinStrict=c.joinLeading=c.all=c.joinTrailing=c.use=c.nextTick=c.setEventEmitter=c.createActions=c.createStore=c.createAction=c.utils=c.StoreMethods=c.PublisherMethods=c.ListenerMethods=c.ActionMethods=c.version=void 0;var h=a("./ActionMethods"),i=d(h),j=a("./ListenerMethods"),k=d(j),l=a("./PublisherMethods"),m=d(l),n=a("./StoreMethods"),o=d(n),p=a("./joins"),q=a("./utils"),r=d(q),s=a("./createAction"),t=a("./createStore"),u=a("./Keep"),v=d(u),w={"reflux-core":"1.0.0"},x=(0,p.staticJoinCreator)("last"),y=x,z=(0,p.staticJoinCreator)("first"),A=(0,p.staticJoinCreator)("strict"),B=(0,p.staticJoinCreator)("all"),C=r,D=function(){var a=function(a,b){Object.keys(a).forEach(function(c){var d=a[c];b[c]=(0,s.createAction)(d)})};return function(b){var c={};return b instanceof Array?b.forEach(function(b){r.isObject(b)?a(b,c):c[b]=(0,s.createAction)(b)}):a(b,c),c}}();c.version=w,c.ActionMethods=i,c.ListenerMethods=k,c.PublisherMethods=m,c.StoreMethods=o,c.utils=C,c.createAction=s.createAction,c.createStore=t.createStore,c.createActions=D,c.setEventEmitter=e,c.nextTick=f,c.use=g,c.joinTrailing=x,c.all=y,c.joinLeading=z,c.joinStrict=A,c.joinConcat=B,c.__keep=v,Object.defineProperty(c,"default",{get:function(){return c}}),Function.prototype.bind||console.error("Function.prototype.bind not available. ES5 shim required. https://github.com/spoike/refluxjs#es5")},{"./ActionMethods":2,"./Keep":3,"./ListenerMethods":4,"./PublisherMethods":5,"./StoreMethods":6,"./createAction":8,"./createStore":9,"./joins":11,"./utils":13}],11:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){return function(){var b=n.call(arguments);return(0,k.createStore)({init:function(){this[o[a]].apply(this,b.concat("triggerAsync"))}})}}function f(a){return function(){m.throwIf(arguments.length<2,"Cannot create a join with less than 2 listenables!");var b,c,d=n.call(arguments),e=d.pop(),f=d.length,j={numberOfListenables:f,callback:this[e]||e,listener:this,strategy:a},k=[];for(b=0;f>b;b++)m.throwIf(this.validateListening(d[b]));for(b=0;f>b;b++)k.push(d[b].listen(i(b,j),this));return h(j),c={listenable:d},c.stop=g(c,k,this),this.subscriptions=(this.subscriptions||[]).concat(c),c}}function g(a,b,c){return function(){var d,e=c.subscriptions,f=e?e.indexOf(a):-1;for(m.throwIf(-1===f,"Tried to remove join already gone from subscriptions list!"),d=0;d<b.length;d++)b[d]();e.splice(f,1)}}function h(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function i(a,b){return function(){var c=n.call(arguments);if(b.listenablesEmitted[a])switch(b.strategy){case"strict":throw new Error("Strict join failed because listener triggered twice.");case"last":b.args[a]=c;break;case"all":b.args[a].push(c)}else b.listenablesEmitted[a]=!0,b.args[a]="all"===b.strategy?[c]:c;j(b)}}function j(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),h(a)}Object.defineProperty(c,"__esModule",{value:!0}),c.staticJoinCreator=e,c.instanceJoinCreator=f;var k=a("./createStore"),l=a("./utils"),m=d(l),n=Array.prototype.slice,o={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"}},{"./createStore":9,"./utils":13}],12:[function(a,b,c){"use strict";function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b}function e(a){var b={init:[],preEmit:[],shouldEmit:[]},c=function d(a){var c={};return a.mixins&&a.mixins.forEach(function(a){g.extend(c,d(a))}),g.extend(c,a),Object.keys(b).forEach(function(c){a.hasOwnProperty(c)&&b[c].push(a[c])}),c}(a);return b.init.length>1&&(c.init=function(){var a=arguments;b.init.forEach(function(b){b.apply(this,a)},this)}),b.preEmit.length>1&&(c.preEmit=function(){return b.preEmit.reduce(function(a,b){var c=b.apply(this,a);return void 0===c?a:[c]}.bind(this),arguments)}),b.shouldEmit.length>1&&(c.shouldEmit=function(){var a=arguments;return!b.shouldEmit.some(function(b){return!b.apply(this,a)},this)}),Object.keys(b).forEach(function(a){1===b[a].length&&(c[a]=b[a][0])}),c}Object.defineProperty(c,"__esModule",{value:!0}),c.mix=e;var f=a("./utils"),g=d(f)},{"./utils":13}],13:[function(a,b,c){"use strict";function d(a){return a.charAt(0).toUpperCase()+a.slice(1)}function e(a,b){return b=b||"on",b+c.capitalize(a)}function f(a){var b="undefined"==typeof a?"undefined":m(a);return"function"===b||"object"===b&&!!a}function g(a){if(!f(a))return a;for(var b,c,d,e=1,g=arguments.length;g>e;e++){b=arguments[e],c=Object.keys(b);for(var h=0;h<c.length;h++)if(d=c[h],Object.getOwnPropertyDescriptor&&Object.defineProperty){var i=Object.getOwnPropertyDescriptor(b,d);Object.defineProperty(a,d,i)}else a[d]=b[d]}return a}function h(a){return"function"==typeof a}function i(a){setTimeout(a,0)}function j(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c}function k(a){return"object"===("undefined"==typeof a?"undefined":m(a))&&"callee"in a&&"number"==typeof a.length}function l(a,b){if(a)throw Error(b||a)}Object.defineProperty(c,"__esModule",{value:!0});var m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};c.capitalize=d,c.callbackName=e,c.isObject=f,c.extend=g,c.isFunction=h,c.nextTick=i,c.object=j,c.isArguments=k,c.throwIf=l,c.EventEmitter=a("eventemitter3")},{eventemitter3:1}],14:[function(a,b,c){var d=a("reflux-core/lib/utils"),e=a("reflux-core/lib/ListenerMethods");b.exports=d.extend({componentWillUnmount:e.stopListeningToAll},e)},{"reflux-core/lib/ListenerMethods":4,"reflux-core/lib/utils":13}],15:[function(a,b,c){var d=a("reflux-core");if(d.defineReact=a("./defineReact"),d.utils.inherits=function(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)},"undefined"!=typeof React&&React)d.defineReact(React);else try{var e=a("react");d.defineReact(e)}catch(f){}},{"./defineReact":18,react:void 0,"reflux-core":10}],16:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods"),e=a("./ListenerMixin"),f=a("reflux-core/lib/utils");b.exports=function(a,b){return f.throwIf("undefined"==typeof b,"Reflux.connect() requires a key."),{getInitialState:function(){return f.isFunction(a.getInitialState)?f.object([b],[a.getInitialState()]):{}},componentDidMount:function(){var c=this;f.extend(c,d),this.listenTo(a,function(a){c.setState(f.object([b],[a]))})},componentWillUnmount:e.componentWillUnmount}}},{"./ListenerMixin":14,"reflux-core/lib/ListenerMethods":4,"reflux-core/lib/utils":13}],17:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods"),e=a("./ListenerMixin"),f=a("reflux-core/lib/utils");b.exports=function(a,b,c){return f.throwIf(f.isFunction(b),"Reflux.connectFilter() requires a key."),{getInitialState:function(){if(!f.isFunction(a.getInitialState))return{};var d=c.call(this,a.getInitialState());return"undefined"!=typeof d?f.object([b],[d]):{}},componentDidMount:function(){var e=this;f.extend(this,d),this.listenTo(a,function(a){var d=c.call(e,a);e.setState(f.object([b],[d]))})},componentWillUnmount:e.componentWillUnmount}}},{"./ListenerMixin":14,"reflux-core/lib/ListenerMethods":4,"reflux-core/lib/utils":13}],18:[function(a,b,c){function d(a,b,c){var j,k;try{g=a||g||React,k=c||g.Component}catch(l){return}if(g&&k&&(!i||c)){var m=function(a,b,c){k.call(this,a,b,c)};if(h.utils.inherits(m,k),j=m.prototype,j.storeKeys=null,j.componentWillMount=function(){if(this.store&&(Array.isArray(this.stores)?this.stores.unshift(this.store):this.stores=[this.store]),this.stores){this.__storeunsubscribes__=this.__storeunsubscribes__||[];for(var a=this.setState.bind(this),b=function(b){var c=e(this.storeKeys,b);c&&a(c)}.bind(this),c=0,d=this.stores.length;d>c;c++){var f=this.stores[c];if("function"==typeof f){var g=f.id;if(f.singleton||(f.singleton=new f,g&&(h.stores[g]=f.singleton)),this.stores[c]=f=f.singleton,f.id=g,g&&h.GlobalState[g]){for(var i in h.GlobalState[g])f.state[i]=h.GlobalState[g][i];h.GlobalState[g]=f.state}else g&&(h.GlobalState[g]=f.state)}h.serverMode||this.__storeunsubscribes__.push(f.listen(b));var j=e(this.storeKeys,f.state);j&&this.setState(j)}}this.__readytomap__=!0;var k=this.__delayedmaps__;if(k)for(var l=0,m=k.length;m>l;l++)k[l].func(k[l].state);this.__delayedmaps__=null},j.componentWillUnmount=function(){if(this.__storeunsubscribes__)for(var a=0,b=this.__storeunsubscribes__.length;b>a;a++)this.__storeunsubscribes__[a]();this.__readytomap__=!1},j.mapStoreToState=function(a,b){function c(a){var c=b.call(d,a);if(c){var e=!1;for(var f in c){e=!0;break}e&&d.setState(c)}}"function"==typeof a&&(a=a.singleton?a.singleton:h.initStore(a));var d=this;this.__storeunsubscribes__=this.__storeunsubscribes__||[],this.__storeunsubscribes__.push(a.listen(c)),this.__readytomap__?c(a.state):(this.__delayedmaps__=this.__delayedmaps__||[],this.__delayedmaps__.push({func:c,state:a.state}))},m.extend=function(a){return d(null,null,a)},c)return m;h.Component=m,g.PureComponent&&(h.PureComponent=m.extend(g.PureComponent));var n=function(){this.__store__=h.createStore(),this.state={};var a=this;for(var b in this.__store__)!function(b){Object.defineProperty(a,b,{get:function(){return a.__store__[b]},set:function(c){a.__store__[b]=c}})}(b)};j=n.prototype,Object.defineProperty(j,"listenables",{get:function(){return this.__listenables__},set:function(a){var b={};Array.isArray(a)?a.forEach(function(a){for(var c in a)b[c]=a[c]}):b=a,this.__listenables__=b,this.listenToMany(b)},enumerable:!0,configurable:!0}),j.setState=function(a){for(var b in a)this.state[b]=a[b];this.id&&(h.GlobalState[this.id]=this.state),this.trigger(a)},Object.defineProperty(n,"isES6Store",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(n,"state",{get:function(){if(!this.singleton)throw new Error("Reflux.Store.state is inaccessible before the store has been initialized.");return this.singleton.state},enumerable:!0,configurable:!0}),h.Store=n,h.GlobalState=h.GlobalState||{},h.stores={},h.getGlobalState=function(){return f(h.GlobalState)},h.setGlobalState=function(a){for(var b in a)h.stores[b]?h.stores[b].setState(a[b]):h.GlobalState[b]=a[b]},h.initializeGlobalStore=h.initStore=function(a){var b=a.id;if(a.singleton)return a.singleton;if(!b)return a.singleton=new a,a.singleton;var c=a.singleton=new a;if(h.stores[b]=c,c.id=b,h.GlobalState[b]){for(var d in h.GlobalState[b])c.state[d]=h.GlobalState[b][d];h.GlobalState[b]=c.state}else h.GlobalState[b]=c.state;return c},i=!0}}function e(a,b){if(!a)return b;for(var c=!1,d={},e=0,f=a.length;f>e;e++){var g=a[e];b.hasOwnProperty(g)&&(c=!0,d[g]=b[g])}return c?d:!1}function f(a,b){if(null===a||"object"!=typeof a)return a;if(a.constructor!==Object&&a.constructor!==Array)return a;if(a.constructor===Date||a.constructor===RegExp||a.constructor===Function||a.constructor===String||a.constructor===Number||a.constructor===Boolean)return new a.constructor(a);b=b||new a.constructor;for(var c in a)b[c]="undefined"==typeof b[c]?f(a[c],null):b[c];return b}var g,h=a("reflux-core"),i=!1;b.exports=d},{"reflux-core":10}],19:[function(a,b,c){var d=a("reflux-core");d.serverMode="object"!=typeof window,d.connect=a("./connect"),d.connectFilter=a("./connectFilter"),d.ListenerMixin=a("./ListenerMixin"),d.listenTo=a("./listenTo"),d.listenToMany=a("./listenToMany"),a("./addES6"),b.exports=d},{"./ListenerMixin":14,"./addES6":15,"./connect":16,"./connectFilter":17,"./listenTo":20,"./listenToMany":21,"reflux-core":10}],20:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods");b.exports=function(a,b,c){return{componentDidMount:function(){for(var e in d)if(this[e]!==d[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=d[e]}this.listenTo(a,b,c)},componentWillUnmount:d.stopListeningToAll}}},{"reflux-core/lib/ListenerMethods":4}],21:[function(a,b,c){var d=a("reflux-core/lib/ListenerMethods");b.exports=function(a){return{componentDidMount:function(){for(var b in d)if(this[b]!==d[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=d[b]}this.listenToMany(a)},componentWillUnmount:d.stopListeningToAll}}},{"reflux-core/lib/ListenerMethods":4}]},{},[19])(19)}); |
{ | ||
"name": "reflux", | ||
"version": "6.3.0", | ||
"version": "6.4.1", | ||
"description": "A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -7,2 +7,25 @@ | ||
// useful utility for ES6 work, mimics the ability to extend | ||
Reflux.utils.inherits = function(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) { | ||
if (Object.setPrototypeOf) { | ||
Object.setPrototypeOf(subClass, superClass); | ||
} else { | ||
/* jshint proto: true */ | ||
subClass.__proto__ = superClass; | ||
} | ||
} | ||
}; | ||
// first try to see if there's a global React var and use it | ||
@@ -9,0 +32,0 @@ if (typeof React !== 'undefined' && React) { |
@@ -50,3 +50,3 @@ /* globals React: false */ | ||
// equivalent of `extends React.Component` or other class if provided via `extend` param | ||
ext(RefluxComponent, _extend); | ||
Reflux.utils.inherits(RefluxComponent, _extend); | ||
@@ -320,2 +320,14 @@ proto = RefluxComponent.prototype; | ||
// allows a shortcut for accessing MyStore.singleton.state as MyStore.state (since common usage makes a singleton) | ||
Object.defineProperty(RefluxStore, "state", { | ||
get: function () { | ||
if (!this.singleton) { | ||
throw new Error('Reflux.Store.state is inaccessible before the store has been initialized.'); | ||
} | ||
return this.singleton.state; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/* NOTE: | ||
@@ -441,15 +453,2 @@ If a Reflux.Store definition is given a static id property and used | ||
// used as a well tested way to mimic ES6 class `extends` in ES5 code | ||
function ext(d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) { | ||
d[p] = b[p]; | ||
} | ||
} | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
// this is utilized by some of the global state functionality in order to get a clone that will | ||
@@ -456,0 +455,0 @@ // not continue to be modified as the GlobalState mutates |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
231061
2486