Comparing version 0.2.7 to 0.2.8
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Reflux=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Reflux = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -44,5 +44,6 @@ | ||
if (!this._events || !this._events[event]) return []; | ||
if (this._events[event].fn) return [this._events[event].fn]; | ||
for (var i = 0, l = this._events[event].length, ee = []; i < l; i++) { | ||
ee.push(this._events[event][i].fn); | ||
for (var i = 0, l = this._events[event].length, ee = new Array(l); i < l; i++) { | ||
ee[i] = this._events[event][i].fn; | ||
} | ||
@@ -64,18 +65,16 @@ | ||
var listeners = this._events[event] | ||
, length = listeners.length | ||
, len = arguments.length | ||
, ee = listeners[0] | ||
, args | ||
, i, j; | ||
, i; | ||
if (1 === length) { | ||
if (ee.once) this.removeListener(event, ee.fn, true); | ||
if ('function' === typeof listeners.fn) { | ||
if (listeners.once) this.removeListener(event, listeners.fn, true); | ||
switch (len) { | ||
case 1: return ee.fn.call(ee.context), true; | ||
case 2: return ee.fn.call(ee.context, a1), true; | ||
case 3: return ee.fn.call(ee.context, a1, a2), true; | ||
case 4: return ee.fn.call(ee.context, a1, a2, a3), true; | ||
case 5: return ee.fn.call(ee.context, a1, a2, a3, a4), true; | ||
case 6: return ee.fn.call(ee.context, a1, a2, a3, a4, a5), true; | ||
case 1: return listeners.fn.call(listeners.context), true; | ||
case 2: return listeners.fn.call(listeners.context, a1), true; | ||
case 3: return listeners.fn.call(listeners.context, a1, a2), true; | ||
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; | ||
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; | ||
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; | ||
} | ||
@@ -87,4 +86,7 @@ | ||
ee.fn.apply(ee.context, args); | ||
listeners.fn.apply(listeners.context, args); | ||
} else { | ||
var length = listeners.length | ||
, j; | ||
for (i = 0; i < length; i++) { | ||
@@ -119,5 +121,12 @@ if (listeners[i].once) this.removeListener(event, listeners[i].fn, true); | ||
EventEmitter.prototype.on = function on(event, fn, context) { | ||
var listener = new EE(fn, context || this); | ||
if (!this._events) this._events = {}; | ||
if (!this._events[event]) this._events[event] = []; | ||
this._events[event].push(new EE( fn, context || this )); | ||
if (!this._events[event]) this._events[event] = listener; | ||
else { | ||
if (!this._events[event].fn) this._events[event].push(listener); | ||
else this._events[event] = [ | ||
this._events[event], listener | ||
]; | ||
} | ||
@@ -136,5 +145,12 @@ return this; | ||
EventEmitter.prototype.once = function once(event, fn, context) { | ||
var listener = new EE(fn, context || this, true); | ||
if (!this._events) this._events = {}; | ||
if (!this._events[event]) this._events[event] = []; | ||
this._events[event].push(new EE(fn, context || this, true )); | ||
if (!this._events[event]) this._events[event] = listener; | ||
else { | ||
if (!this._events[event].fn) this._events[event].push(listener); | ||
else this._events[event] = [ | ||
this._events[event], listener | ||
]; | ||
} | ||
@@ -158,6 +174,11 @@ return this; | ||
if (fn) for (var i = 0, length = listeners.length; i < length; i++) { | ||
if (listeners[i].fn !== fn && listeners[i].once !== once) { | ||
events.push(listeners[i]); | ||
if (fn) { | ||
if (listeners.fn && (listeners.fn !== fn || (once && !listeners.once))) { | ||
events.push(listeners); | ||
} | ||
if (!listeners.fn) for (var i = 0, length = listeners.length; i < length; i++) { | ||
if (listeners[i].fn !== fn || (once && !listeners[i].once)) { | ||
events.push(listeners[i]); | ||
} | ||
} | ||
} | ||
@@ -168,4 +189,7 @@ | ||
// | ||
if (events.length) this._events[event] = events; | ||
else this._events[event] = null; | ||
if (events.length) { | ||
this._events[event] = events.length === 1 ? events[0] : events; | ||
} else { | ||
delete this._events[event]; | ||
} | ||
@@ -184,3 +208,3 @@ return this; | ||
if (event) this._events[event] = null; | ||
if (event) delete this._events[event]; | ||
else this._events = {}; | ||
@@ -211,16 +235,17 @@ | ||
if ('object' === typeof module && module.exports) { | ||
module.exports = EventEmitter; | ||
} | ||
// | ||
// Expose the module. | ||
// | ||
module.exports = EventEmitter; | ||
},{}],2:[function(_dereq_,module,exports){ | ||
},{}],2:[function(require,module,exports){ | ||
(function (global){ | ||
/*! Native Promise Only | ||
v0.7.6-a (c) Kyle Simpson | ||
v0.7.8-a (c) Kyle Simpson | ||
MIT License: http://getify.mit-license.org | ||
*/ | ||
!function(t,n,e){n[t]=n[t]||e(),"undefined"!=typeof module&&module.exports?module.exports=n[t]:"function"==typeof define&&define.amd&&define(function(){return n[t]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function t(t,n){l.add(t,n),h||(h=y(l.drain))}function n(t){var n,e=typeof t;return null==t||"object"!=e&&"function"!=e||(n=t.then),"function"==typeof n?n:!1}function e(){for(var t=0;t<this.chain.length;t++)o(this,1===this.state?this.chain[t].success:this.chain[t].failure,this.chain[t]);this.chain.length=0}function o(t,e,o){var r,i;try{e===!1?o.reject(t.msg):(r=e===!0?t.msg:e.call(void 0,t.msg),r===o.promise?o.reject(TypeError("Promise-chain cycle")):(i=n(r))?i.call(r,o.resolve,o.reject):o.resolve(r))}catch(c){o.reject(c)}}function r(o){var c,u,a=this;if(!a.triggered){a.triggered=!0,a.def&&(a=a.def);try{(c=n(o))?(u=new f(a),c.call(o,function(){r.apply(u,arguments)},function(){i.apply(u,arguments)})):(a.msg=o,a.state=1,a.chain.length>0&&t(e,a))}catch(s){i.call(u||new f(a),s)}}}function i(n){var o=this;o.triggered||(o.triggered=!0,o.def&&(o=o.def),o.msg=n,o.state=2,o.chain.length>0&&t(e,o))}function c(t,n,e,o){for(var r=0;r<n.length;r++)!function(r){t.resolve(n[r]).then(function(t){e(r,t)},o)}(r)}function f(t){this.def=t,this.triggered=!1}function u(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function a(n){if("function"!=typeof n)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var o=new u(this);this.then=function(n,r){var i={success:"function"==typeof n?n:!0,failure:"function"==typeof r?r:!1};return i.promise=new this.constructor(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");i.resolve=t,i.reject=n}),o.chain.push(i),0!==o.state&&t(e,o),i.promise},this["catch"]=function(t){return this.then(void 0,t)};try{n.call(void 0,function(t){r.call(o,t)},function(t){i.call(o,t)})}catch(c){i.call(o,c)}}var s,h,l,p=Object.prototype.toString,y="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout;try{Object.defineProperty({},"x",{}),s=function(t,n,e,o){return Object.defineProperty(t,n,{value:e,writable:!0,configurable:o!==!1})}}catch(d){s=function(t,n,e){return t[n]=e,t}}l=function(){function t(t,n){this.fn=t,this.self=n,this.next=void 0}var n,e,o;return{add:function(r,i){o=new t(r,i),e?e.next=o:n=o,e=o,o=void 0},drain:function(){var t=n;for(n=e=h=void 0;t;)t.fn.call(t.self),t=t.next}}}();var g=s({},"constructor",a,!1);return s(a,"prototype",g,!1),s(g,"__NPO__",0,!1),s(a,"resolve",function(t){var n=this;return t&&"object"==typeof t&&1===t.__NPO__?t:new n(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");n(t)})}),s(a,"reject",function(t){return new this(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");e(t)})}),s(a,"all",function(t){var n=this;return"[object Array]"!=p.call(t)?n.reject(TypeError("Not an array")):0===t.length?n.resolve([]):new n(function(e,o){if("function"!=typeof e||"function"!=typeof o)throw TypeError("Not a function");var r=t.length,i=Array(r),f=0;c(n,t,function(t,n){i[t]=n,++f===r&&e(i)},o)})}),s(a,"race",function(t){var n=this;return"[object Array]"!=p.call(t)?n.reject(TypeError("Not an array")):new n(function(e,o){if("function"!=typeof e||"function"!=typeof o)throw TypeError("Not a function");c(n,t,function(t,n){e(n)},o)})}),a}); | ||
!function(t,n,e){n[t]=n[t]||e(),"undefined"!=typeof module&&module.exports?module.exports=n[t]:"function"==typeof define&&define.amd&&define(function(){return n[t]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function t(t,n){l.add(t,n),h||(h=y(l.drain))}function n(t){var n,e=typeof t;return null==t||"object"!=e&&"function"!=e||(n=t.then),"function"==typeof n?n:!1}function e(){for(var t=0;t<this.chain.length;t++)o(this,1===this.state?this.chain[t].success:this.chain[t].failure,this.chain[t]);this.chain.length=0}function o(t,e,o){var r,i;try{e===!1?o.reject(t.msg):(r=e===!0?t.msg:e.call(void 0,t.msg),r===o.promise?o.reject(TypeError("Promise-chain cycle")):(i=n(r))?i.call(r,o.resolve,o.reject):o.resolve(r))}catch(c){o.reject(c)}}function r(o){var c,u,a=this;if(!a.triggered){a.triggered=!0,a.def&&(a=a.def);try{(c=n(o))?(u=new f(a),c.call(o,function(){r.apply(u,arguments)},function(){i.apply(u,arguments)})):(a.msg=o,a.state=1,a.chain.length>0&&t(e,a))}catch(s){i.call(u||new f(a),s)}}}function i(n){var o=this;o.triggered||(o.triggered=!0,o.def&&(o=o.def),o.msg=n,o.state=2,o.chain.length>0&&t(e,o))}function c(t,n,e,o){for(var r=0;r<n.length;r++)!function(r){t.resolve(n[r]).then(function(t){e(r,t)},o)}(r)}function f(t){this.def=t,this.triggered=!1}function u(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function a(n){if("function"!=typeof n)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var o=new u(this);this.then=function(n,r){var i={success:"function"==typeof n?n:!0,failure:"function"==typeof r?r:!1};return i.promise=new this.constructor(function(t,n){if("function"!=typeof t||"function"!=typeof n)throw TypeError("Not a function");i.resolve=t,i.reject=n}),o.chain.push(i),0!==o.state&&t(e,o),i.promise},this["catch"]=function(t){return this.then(void 0,t)};try{n.call(void 0,function(t){r.call(o,t)},function(t){i.call(o,t)})}catch(c){i.call(o,c)}}var s,h,l,p=Object.prototype.toString,y="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout;try{Object.defineProperty({},"x",{}),s=function(t,n,e,o){return Object.defineProperty(t,n,{value:e,writable:!0,configurable:o!==!1})}}catch(d){s=function(t,n,e){return t[n]=e,t}}l=function(){function t(t,n){this.fn=t,this.self=n,this.next=void 0}var n,e,o;return{add:function(r,i){o=new t(r,i),e?e.next=o:n=o,e=o,o=void 0},drain:function(){var t=n;for(n=e=h=void 0;t;)t.fn.call(t.self),t=t.next}}}();var g=s({},"constructor",a,!1);return a.prototype=g,s(g,"__NPO__",0,!1),s(a,"resolve",function(t){var n=this;return t&&"object"==typeof t&&1===t.__NPO__?t:new n(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");n(t)})}),s(a,"reject",function(t){return new this(function(n,e){if("function"!=typeof n||"function"!=typeof e)throw TypeError("Not a function");e(t)})}),s(a,"all",function(t){var n=this;return"[object Array]"!=p.call(t)?n.reject(TypeError("Not an array")):0===t.length?n.resolve([]):new n(function(e,o){if("function"!=typeof e||"function"!=typeof o)throw TypeError("Not a function");var r=t.length,i=Array(r),f=0;c(n,t,function(t,n){i[t]=n,++f===r&&e(i)},o)})}),s(a,"race",function(t){var n=this;return"[object Array]"!=p.call(t)?n.reject(TypeError("Not an array")):new n(function(e,o){if("function"!=typeof e||"function"!=typeof o)throw TypeError("Not a function");c(n,t,function(t,n){e(n)},o)})}),a}); | ||
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],3:[function(_dereq_,module,exports){ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],3:[function(require,module,exports){ | ||
/** | ||
@@ -233,3 +258,3 @@ * A module of methods that you want to include in all actions. | ||
},{}],4:[function(_dereq_,module,exports){ | ||
},{}],4:[function(require,module,exports){ | ||
exports.createdStores = []; | ||
@@ -248,5 +273,5 @@ | ||
},{}],5:[function(_dereq_,module,exports){ | ||
var _ = _dereq_('./utils'), | ||
maker = _dereq_('./joins').instanceJoinCreator; | ||
},{}],5:[function(require,module,exports){ | ||
var _ = require('./utils'), | ||
maker = require('./joins').instanceJoinCreator; | ||
@@ -471,5 +496,5 @@ /** | ||
},{"./joins":15,"./utils":19}],6:[function(_dereq_,module,exports){ | ||
var _ = _dereq_('./utils'), | ||
ListenerMethods = _dereq_('./ListenerMethods'); | ||
},{"./joins":15,"./utils":19}],6:[function(require,module,exports){ | ||
var _ = require('./utils'), | ||
ListenerMethods = require('./ListenerMethods'); | ||
@@ -491,4 +516,4 @@ /** | ||
},{"./ListenerMethods":5,"./utils":19}],7:[function(_dereq_,module,exports){ | ||
var _ = _dereq_('./utils'); | ||
},{"./ListenerMethods":5,"./utils":19}],7:[function(require,module,exports){ | ||
var _ = require('./utils'); | ||
@@ -675,3 +700,3 @@ /** | ||
},{"./utils":19}],8:[function(_dereq_,module,exports){ | ||
},{"./utils":19}],8:[function(require,module,exports){ | ||
/** | ||
@@ -684,3 +709,3 @@ * A module of methods that you want to include in all stores. | ||
},{}],9:[function(_dereq_,module,exports){ | ||
},{}],9:[function(require,module,exports){ | ||
module.exports = function(store, definition) { | ||
@@ -710,5 +735,5 @@ for (var name in definition) { | ||
},{}],10:[function(_dereq_,module,exports){ | ||
var Reflux = _dereq_('./index'), | ||
_ = _dereq_('./utils'); | ||
},{}],10:[function(require,module,exports){ | ||
var Reflux = require('./index'), | ||
_ = require('./utils'); | ||
@@ -728,3 +753,7 @@ module.exports = function(listenable,key){ | ||
_.extend(this,Reflux.ListenerMethods); | ||
var me = this, cb = (key === undefined ? this.setState : function(v){me.setState(_.object([key],[v]));}); | ||
var me = this, cb = (key === undefined ? this.setState : function(v){ | ||
if (typeof me.isMounted === "undefined" || me.isMounted() === true) { | ||
me.setState(_.object([key],[v])); | ||
} | ||
}); | ||
this.listenTo(listenable,cb); | ||
@@ -736,5 +765,5 @@ }, | ||
},{"./index":14,"./utils":19}],11:[function(_dereq_,module,exports){ | ||
var Reflux = _dereq_('./index'), | ||
_ = _dereq_('./utils'); | ||
},{"./index":14,"./utils":19}],11:[function(require,module,exports){ | ||
var Reflux = require('./index'), | ||
_ = require('./utils'); | ||
@@ -778,6 +807,6 @@ module.exports = function(listenable, key, filterFunc) { | ||
},{"./index":14,"./utils":19}],12:[function(_dereq_,module,exports){ | ||
var _ = _dereq_('./utils'), | ||
Reflux = _dereq_('./index'), | ||
Keep = _dereq_('./Keep'), | ||
},{"./index":14,"./utils":19}],12:[function(require,module,exports){ | ||
var _ = require('./utils'), | ||
Reflux = require('./index'), | ||
Keep = require('./Keep'), | ||
allowed = {preEmit:1,shouldEmit:1}; | ||
@@ -846,9 +875,9 @@ | ||
},{"./Keep":4,"./index":14,"./utils":19}],13:[function(_dereq_,module,exports){ | ||
var _ = _dereq_('./utils'), | ||
Reflux = _dereq_('./index'), | ||
Keep = _dereq_('./Keep'), | ||
mixer = _dereq_('./mixer'), | ||
},{"./Keep":4,"./index":14,"./utils":19}],13:[function(require,module,exports){ | ||
var _ = require('./utils'), | ||
Reflux = require('./index'), | ||
Keep = require('./Keep'), | ||
mixer = require('./mixer'), | ||
allowed = {preEmit:1,shouldEmit:1}, | ||
bindMethods = _dereq_('./bindMethods'); | ||
bindMethods = require('./bindMethods'); | ||
@@ -910,27 +939,27 @@ /** | ||
},{"./Keep":4,"./bindMethods":9,"./index":14,"./mixer":18,"./utils":19}],14:[function(_dereq_,module,exports){ | ||
exports.ActionMethods = _dereq_('./ActionMethods'); | ||
},{"./Keep":4,"./bindMethods":9,"./index":14,"./mixer":18,"./utils":19}],14:[function(require,module,exports){ | ||
exports.ActionMethods = require('./ActionMethods'); | ||
exports.ListenerMethods = _dereq_('./ListenerMethods'); | ||
exports.ListenerMethods = require('./ListenerMethods'); | ||
exports.PublisherMethods = _dereq_('./PublisherMethods'); | ||
exports.PublisherMethods = require('./PublisherMethods'); | ||
exports.StoreMethods = _dereq_('./StoreMethods'); | ||
exports.StoreMethods = require('./StoreMethods'); | ||
exports.createAction = _dereq_('./createAction'); | ||
exports.createAction = require('./createAction'); | ||
exports.createStore = _dereq_('./createStore'); | ||
exports.createStore = require('./createStore'); | ||
exports.connect = _dereq_('./connect'); | ||
exports.connect = require('./connect'); | ||
exports.connectFilter = _dereq_('./connectFilter'); | ||
exports.connectFilter = require('./connectFilter'); | ||
exports.ListenerMixin = _dereq_('./ListenerMixin'); | ||
exports.ListenerMixin = require('./ListenerMixin'); | ||
exports.listenTo = _dereq_('./listenTo'); | ||
exports.listenTo = require('./listenTo'); | ||
exports.listenToMany = _dereq_('./listenToMany'); | ||
exports.listenToMany = require('./listenToMany'); | ||
var maker = _dereq_('./joins').staticJoinCreator; | ||
var maker = require('./joins').staticJoinCreator; | ||
@@ -945,3 +974,3 @@ exports.joinTrailing = exports.all = maker("last"); // Reflux.all alias for backward compatibility | ||
var _ = _dereq_('./utils'); | ||
var _ = require('./utils'); | ||
@@ -975,3 +1004,3 @@ exports.EventEmitter = _.EventEmitter; | ||
exports.setEventEmitter = function(ctx) { | ||
var _ = _dereq_('./utils'); | ||
var _ = require('./utils'); | ||
exports.EventEmitter = _.EventEmitter = ctx; | ||
@@ -985,3 +1014,3 @@ }; | ||
exports.setPromise = function(ctx) { | ||
var _ = _dereq_('./utils'); | ||
var _ = require('./utils'); | ||
exports.Promise = _.Promise = ctx; | ||
@@ -996,3 +1025,3 @@ }; | ||
exports.setPromiseFactory = function(factory) { | ||
var _ = _dereq_('./utils'); | ||
var _ = require('./utils'); | ||
_.createPromise = factory; | ||
@@ -1006,3 +1035,3 @@ }; | ||
exports.nextTick = function(nextTick) { | ||
var _ = _dereq_('./utils'); | ||
var _ = require('./utils'); | ||
_.nextTick = nextTick; | ||
@@ -1014,3 +1043,3 @@ }; | ||
*/ | ||
exports.__keep = _dereq_('./Keep'); | ||
exports.__keep = require('./Keep'); | ||
@@ -1028,3 +1057,3 @@ /** | ||
},{"./ActionMethods":3,"./Keep":4,"./ListenerMethods":5,"./ListenerMixin":6,"./PublisherMethods":7,"./StoreMethods":8,"./connect":10,"./connectFilter":11,"./createAction":12,"./createStore":13,"./joins":15,"./listenTo":16,"./listenToMany":17,"./utils":19}],15:[function(_dereq_,module,exports){ | ||
},{"./ActionMethods":3,"./Keep":4,"./ListenerMethods":5,"./ListenerMixin":6,"./PublisherMethods":7,"./StoreMethods":8,"./connect":10,"./connectFilter":11,"./createAction":12,"./createStore":13,"./joins":15,"./listenTo":16,"./listenToMany":17,"./utils":19}],15:[function(require,module,exports){ | ||
/** | ||
@@ -1035,4 +1064,4 @@ * Internal module used to create static and instance join methods | ||
var slice = Array.prototype.slice, | ||
_ = _dereq_("./utils"), | ||
createStore = _dereq_("./createStore"), | ||
_ = require("./utils"), | ||
createStore = require("./createStore"), | ||
strategyMethodNames = { | ||
@@ -1138,4 +1167,4 @@ strict: "joinStrict", | ||
},{"./createStore":13,"./utils":19}],16:[function(_dereq_,module,exports){ | ||
var Reflux = _dereq_('./index'); | ||
},{"./createStore":13,"./utils":19}],16:[function(require,module,exports){ | ||
var Reflux = require('./index'); | ||
@@ -1177,4 +1206,4 @@ | ||
},{"./index":14}],17:[function(_dereq_,module,exports){ | ||
var Reflux = _dereq_('./index'); | ||
},{"./index":14}],17:[function(require,module,exports){ | ||
var Reflux = require('./index'); | ||
@@ -1213,4 +1242,4 @@ /** | ||
},{"./index":14}],18:[function(_dereq_,module,exports){ | ||
var _ = _dereq_('./utils'); | ||
},{"./index":14}],18:[function(require,module,exports){ | ||
var _ = require('./utils'); | ||
@@ -1273,3 +1302,3 @@ module.exports = function mix(def) { | ||
},{"./utils":19}],19:[function(_dereq_,module,exports){ | ||
},{"./utils":19}],19:[function(require,module,exports){ | ||
/* | ||
@@ -1307,3 +1336,3 @@ * isObject, extend, isFunction, isArguments are taken from undescore/lodash in | ||
exports.EventEmitter = _dereq_('eventemitter3'); | ||
exports.EventEmitter = require('eventemitter3'); | ||
@@ -1324,3 +1353,3 @@ exports.nextTick = function(callback) { | ||
var o={}, i=0; | ||
for(;i<keys.length;i++){ | ||
for(;i < keys.length; i++){ | ||
o[keys[i]] = vals[i]; | ||
@@ -1331,3 +1360,3 @@ } | ||
exports.Promise = _dereq_("native-promise-only"); | ||
exports.Promise = require("native-promise-only"); | ||
@@ -1348,4 +1377,3 @@ exports.createPromise = function(resolver) { | ||
},{"eventemitter3":1,"native-promise-only":2}]},{},[14]) | ||
(14) | ||
},{"eventemitter3":1,"native-promise-only":2}]},{},[14])(14) | ||
}); |
@@ -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;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.Reflux=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[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:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,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){"use strict";function c(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function d(){}d.prototype._events=void 0,d.prototype.listeners=function(a){if(!this._events||!this._events[a])return[];for(var b=0,c=this._events[a].length,d=[];c>b;b++)d.push(this._events[a][b].fn);return d},d.prototype.emit=function(a,b,c,d,e,f){if(!this._events||!this._events[a])return!1;var g,h,i,j=this._events[a],k=j.length,l=arguments.length,m=j[0];if(1===k){switch(m.once&&this.removeListener(a,m.fn,!0),l){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,b),!0;case 3:return m.fn.call(m.context,b,c),!0;case 4:return m.fn.call(m.context,b,c,d),!0;case 5:return m.fn.call(m.context,b,c,d,e),!0;case 6:return m.fn.call(m.context,b,c,d,e,f),!0}for(h=1,g=new Array(l-1);l>h;h++)g[h-1]=arguments[h];m.fn.apply(m.context,g)}else for(h=0;k>h;h++)switch(j[h].once&&this.removeListener(a,j[h].fn,!0),l){case 1:j[h].fn.call(j[h].context);break;case 2:j[h].fn.call(j[h].context,b);break;case 3:j[h].fn.call(j[h].context,b,c);break;default:if(!g)for(i=1,g=new Array(l-1);l>i;i++)g[i-1]=arguments[i];j[h].fn.apply(j[h].context,g)}return!0},d.prototype.on=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this)),this},d.prototype.once=function(a,b,d){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),this._events[a].push(new c(b,d||this,!0)),this},d.prototype.removeListener=function(a,b,c){if(!this._events||!this._events[a])return this;var d=this._events[a],e=[];if(b)for(var f=0,g=d.length;g>f;f++)d[f].fn!==b&&d[f].once!==c&&e.push(d[f]);return this._events[a]=e.length?e:null,this},d.prototype.removeAllListeners=function(a){return this._events?(a?this._events[a]=null:this._events={},this):this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prototype.setMaxListeners=function(){return this},d.EventEmitter=d,d.EventEmitter2=d,d.EventEmitter3=d,"object"==typeof b&&b.exports&&(b.exports=d)},{}],2:[function(b,c){(function(b){!function(b,d,e){d[b]=d[b]||e(),"undefined"!=typeof c&&c.exports?c.exports=d[b]:"function"==typeof a&&a.amd&&a(function(){return d[b]})}("Promise","undefined"!=typeof b?b:this,function(){"use strict";function a(a,b){m.add(a,b),l||(l=o(m.drain))}function b(a){var b,c=typeof a;return null==a||"object"!=c&&"function"!=c||(b=a.then),"function"==typeof b?b:!1}function c(){for(var a=0;a<this.chain.length;a++)d(this,1===this.state?this.chain[a].success:this.chain[a].failure,this.chain[a]);this.chain.length=0}function d(a,c,d){var e,f;try{c===!1?d.reject(a.msg):(e=c===!0?a.msg:c.call(void 0,a.msg),e===d.promise?d.reject(TypeError("Promise-chain cycle")):(f=b(e))?f.call(e,d.resolve,d.reject):d.resolve(e))}catch(g){d.reject(g)}}function e(d){var g,i,j=this;if(!j.triggered){j.triggered=!0,j.def&&(j=j.def);try{(g=b(d))?(i=new h(j),g.call(d,function(){e.apply(i,arguments)},function(){f.apply(i,arguments)})):(j.msg=d,j.state=1,j.chain.length>0&&a(c,j))}catch(k){f.call(i||new h(j),k)}}}function f(b){var d=this;d.triggered||(d.triggered=!0,d.def&&(d=d.def),d.msg=b,d.state=2,d.chain.length>0&&a(c,d))}function g(a,b,c,d){for(var e=0;e<b.length;e++)!function(e){a.resolve(b[e]).then(function(a){c(e,a)},d)}(e)}function h(a){this.def=a,this.triggered=!1}function i(a){this.promise=a,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function j(b){if("function"!=typeof b)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var d=new i(this);this.then=function(b,e){var f={success:"function"==typeof b?b:!0,failure:"function"==typeof e?e:!1};return f.promise=new this.constructor(function(a,b){if("function"!=typeof a||"function"!=typeof b)throw TypeError("Not a function");f.resolve=a,f.reject=b}),d.chain.push(f),0!==d.state&&a(c,d),f.promise},this["catch"]=function(a){return this.then(void 0,a)};try{b.call(void 0,function(a){e.call(d,a)},function(a){f.call(d,a)})}catch(g){f.call(d,g)}}var k,l,m,n=Object.prototype.toString,o="undefined"!=typeof setImmediate?function(a){return setImmediate(a)}:setTimeout;try{Object.defineProperty({},"x",{}),k=function(a,b,c,d){return Object.defineProperty(a,b,{value:c,writable:!0,configurable:d!==!1})}}catch(p){k=function(a,b,c){return a[b]=c,a}}m=function(){function a(a,b){this.fn=a,this.self=b,this.next=void 0}var b,c,d;return{add:function(e,f){d=new a(e,f),c?c.next=d:b=d,c=d,d=void 0},drain:function(){var a=b;for(b=c=l=void 0;a;)a.fn.call(a.self),a=a.next}}}();var q=k({},"constructor",j,!1);return k(j,"prototype",q,!1),k(q,"__NPO__",0,!1),k(j,"resolve",function(a){var b=this;return a&&"object"==typeof a&&1===a.__NPO__?a:new b(function(b,c){if("function"!=typeof b||"function"!=typeof c)throw TypeError("Not a function");b(a)})}),k(j,"reject",function(a){return new this(function(b,c){if("function"!=typeof b||"function"!=typeof c)throw TypeError("Not a function");c(a)})}),k(j,"all",function(a){var b=this;return"[object Array]"!=n.call(a)?b.reject(TypeError("Not an array")):0===a.length?b.resolve([]):new b(function(c,d){if("function"!=typeof c||"function"!=typeof d)throw TypeError("Not a function");var e=a.length,f=Array(e),h=0;g(b,a,function(a,b){f[a]=b,++h===e&&c(f)},d)})}),k(j,"race",function(a){var b=this;return"[object Array]"!=n.call(a)?b.reject(TypeError("Not an array")):new b(function(c,d){if("function"!=typeof c||"function"!=typeof d)throw TypeError("Not a function");g(b,a,function(a,b){c(b)},d)})}),j})}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(a,b){b.exports={}},{}],4:[function(a,b,c){c.createdStores=[],c.createdActions=[],c.reset=function(){for(;c.createdStores.length;)c.createdStores.pop();for(;c.createdActions.length;)c.createdActions.pop()}},{}],5:[function(a,b){var c=a("./utils"),d=a("./joins").instanceJoinCreator,e=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},f=function(a){var b={};for(var d in a){var g=a[d],h=e(g),i=f(h);b[d]=g;for(var j in i){var k=i[j];b[d+c.capitalize(j)]=k}}return b};b.exports={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},listenToMany:function(a){var b=f(a);for(var d in b){var e=c.callbackName(d),g=this[e]?e:this[d]?d:void 0;g&&this.listenTo(b[d],g,this[e+"Default"]||this[g+"Default"]||g)}},validateListening:function(a){return a===this?"Listener is not able to listen to itself":c.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"},listenTo:function(a,b,d){var e,f,g,h=this.subscriptions=this.subscriptions||[];return c.throwIf(this.validateListening(a)),this.fetchInitialState(a,d),e=a.listen(this[b]||b,this),f=function(){var a=h.indexOf(g);c.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),e()},g={stop:f,listenable:a},h.push(g),g},stopListeningTo:function(a){for(var b,d=0,e=this.subscriptions||[];d<e.length;d++)if(b=e[d],b.listenable===a)return b.stop(),c.throwIf(-1!==e.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},stopListeningToAll:function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),c.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},fetchInitialState:function(a,b){b=b&&this[b]||b;var d=this;if(c.isFunction(b)&&c.isFunction(a.getInitialState)){var e=a.getInitialState();e&&c.isFunction(e.then)?e.then(function(){b.apply(d,arguments)}):b.call(this,e)}},joinTrailing:d("last"),joinLeading:d("first"),joinConcat:d("all"),joinStrict:d("strict")}},{"./joins":15,"./utils":19}],6:[function(a,b){var c=a("./utils"),d=a("./ListenerMethods");b.exports=c.extend({componentWillUnmount:d.stopListeningToAll},d)},{"./ListenerMethods":5,"./utils":19}],7:[function(a,b){var c=a("./utils");b.exports={preEmit:function(){},shouldEmit:function(){return!0},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)}},promise:function(a){var b=this,c=this.children.indexOf("completed")>=0&&this.children.indexOf("failed")>=0;if(!c)throw new Error('Publisher must have "completed" and "failed" child publishers');a.then(function(a){return b.completed(a)},function(a){return b.failed(a)})},listenAndPromise:function(a,b){var c=this;b=b||this,this.willCallPromise=(this.willCallPromise||0)+1;var d=this.listen(function(){if(!a)throw new Error("Expected a function returning a promise but got "+a);var d=arguments,e=a.apply(b,d);return c.promise.call(c,e)},b);return function(){c.willCallPromise--,d.call(c)}},trigger:function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:c.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},triggerAsync:function(){var a=arguments,b=this;c.nextTick(function(){b.trigger.apply(b,a)})},triggerPromise:function(){var a=this,b=arguments,d=this.children.indexOf("completed")>=0&&this.children.indexOf("failed")>=0,e=c.createPromise(function(e,f){if(a.willCallPromise)return void c.nextTick(function(){var c=a.promise;a.promise=function(b){return b.then(e,f),a.promise=c,a.promise.apply(a,arguments)},a.trigger.apply(a,b)});if(d)var g=a.completed.listen(function(a){g(),h(),e(a)}),h=a.failed.listen(function(a){g(),h(),f(a)});a.triggerAsync.apply(a,b),d||e()});return e}}},{"./utils":19}],8:[function(a,b){b.exports={}},{}],9:[function(a,b){b.exports=function(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}},{}],10:[function(a,b){var c=a("./index"),d=a("./utils");b.exports=function(a,b){return{getInitialState:function(){return d.isFunction(a.getInitialState)?void 0===b?a.getInitialState():d.object([b],[a.getInitialState()]):{}},componentDidMount:function(){d.extend(this,c.ListenerMethods);var e=this,f=void 0===b?this.setState:function(a){e.setState(d.object([b],[a]))};this.listenTo(a,f)},componentWillUnmount:c.ListenerMixin.componentWillUnmount}}},{"./index":14,"./utils":19}],11:[function(a,b){var c=a("./index"),d=a("./utils");b.exports=function(a,b,e){return e=d.isFunction(b)?b:e,{getInitialState:function(){if(d.isFunction(a.getInitialState)){if(d.isFunction(b))return e.call(this,a.getInitialState());var c=e.call(this,a.getInitialState());return c?d.object([b],[c]):{}}return{}},componentDidMount:function(){d.extend(this,c.ListenerMethods);var f=this,g=function(a){if(d.isFunction(b))f.setState(e.call(f,a));else{var c=e.call(f,a);f.setState(d.object([b],[c]))}};this.listenTo(a,g)},componentWillUnmount:c.ListenerMixin.componentWillUnmount}}},{"./index":14,"./utils":19}],12:[function(a,b){var c=a("./utils"),d=a("./index"),e=a("./Keep"),f={preEmit:1,shouldEmit:1},g=function(a){a=a||{},c.isObject(a)||(a={actionName:a});for(var b in d.ActionMethods)if(!f[b]&&d.PublisherMethods[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 h in a)if(!f[h]&&d.PublisherMethods[h])throw new Error("Cannot override API method "+h+" 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 i=0,j={};i<a.children.length;i++){var k=a.children[i];j[k]=g(k)}var l=c.extend({eventLabel:"action",emitter:new c.EventEmitter,_isAction:!0},d.PublisherMethods,d.ActionMethods,a),m=function(){return m[m.sync?"trigger":"triggerPromise"].apply(m,arguments)};return c.extend(m,j,l),e.createdActions.push(m),m};b.exports=g},{"./Keep":4,"./index":14,"./utils":19}],13:[function(a,b){var c=a("./utils"),d=a("./index"),e=a("./Keep"),f=a("./mixer"),g={preEmit:1,shouldEmit:1},h=a("./bindMethods");b.exports=function(a){function b(){var b,d=0;if(this.subscriptions=[],this.emitter=new c.EventEmitter,this.eventLabel="change",h(this,a),this.init&&c.isFunction(this.init)&&this.init(),this.listenables)for(b=[].concat(this.listenables);d<b.length;d++)this.listenToMany(b[d])}a=a||{};for(var i in d.StoreMethods)if(!g[i]&&(d.PublisherMethods[i]||d.ListenerMethods[i]))throw new Error("Cannot override API method "+i+" in Reflux.StoreMethods. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");for(var j in a)if(!g[j]&&(d.PublisherMethods[j]||d.ListenerMethods[j]))throw new Error("Cannot override API method "+j+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");a=f(a),c.extend(b.prototype,d.ListenerMethods,d.PublisherMethods,d.StoreMethods,a);var k=new b;return e.createdStores.push(k),k}},{"./Keep":4,"./bindMethods":9,"./index":14,"./mixer":18,"./utils":19}],14:[function(a,b,c){c.ActionMethods=a("./ActionMethods"),c.ListenerMethods=a("./ListenerMethods"),c.PublisherMethods=a("./PublisherMethods"),c.StoreMethods=a("./StoreMethods"),c.createAction=a("./createAction"),c.createStore=a("./createStore"),c.connect=a("./connect"),c.connectFilter=a("./connectFilter"),c.ListenerMixin=a("./ListenerMixin"),c.listenTo=a("./listenTo"),c.listenToMany=a("./listenToMany");var d=a("./joins").staticJoinCreator;c.joinTrailing=c.all=d("last"),c.joinLeading=d("first"),c.joinStrict=d("strict"),c.joinConcat=d("all");var e=a("./utils");c.EventEmitter=e.EventEmitter,c.Promise=e.Promise,c.createActions=function(a){var b={};for(var d in a)if(a.hasOwnProperty(d)){var f=a[d],g=e.isObject(f)?d:f;b[g]=c.createAction(f)}return b},c.setEventEmitter=function(b){var d=a("./utils");c.EventEmitter=d.EventEmitter=b},c.setPromise=function(b){var d=a("./utils");c.Promise=d.Promise=b},c.setPromiseFactory=function(b){var c=a("./utils");c.createPromise=b},c.nextTick=function(b){var c=a("./utils");c.nextTick=b},c.__keep=a("./Keep"),Function.prototype.bind||console.error("Function.prototype.bind not available. ES5 shim required. https://github.com/spoike/refluxjs#es5")},{"./ActionMethods":3,"./Keep":4,"./ListenerMethods":5,"./ListenerMixin":6,"./PublisherMethods":7,"./StoreMethods":8,"./connect":10,"./connectFilter":11,"./createAction":12,"./createStore":13,"./joins":15,"./listenTo":16,"./listenToMany":17,"./utils":19}],15:[function(a,b,c){function d(a,b,c){return function(){var d,e=c.subscriptions,f=e?e.indexOf(a):-1;for(i.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 e(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function f(a,b){return function(){var c=h.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;g(b)}}function g(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),e(a)}var h=Array.prototype.slice,i=a("./utils"),j=a("./createStore"),k={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"};c.staticJoinCreator=function(a){return function(){var b=h.call(arguments);return j({init:function(){this[k[a]].apply(this,b.concat("triggerAsync"))}})}},c.instanceJoinCreator=function(a){return function(){i.throwIf(arguments.length<3,"Cannot create a join with less than 2 listenables!");var b,c,g=h.call(arguments),j=g.pop(),k=g.length,l={numberOfListenables:k,callback:this[j]||j,listener:this,strategy:a},m=[];for(b=0;k>b;b++)i.throwIf(this.validateListening(g[b]));for(b=0;k>b;b++)m.push(g[b].listen(f(b,l),this));return e(l),c={listenable:g},c.stop=d(c,m,this),this.subscriptions=(this.subscriptions||[]).concat(c),c}}},{"./createStore":13,"./utils":19}],16:[function(a,b){var c=a("./index");b.exports=function(a,b,d){return{componentDidMount:function(){for(var e in c.ListenerMethods)if(this[e]!==c.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=c.ListenerMethods[e]}this.listenTo(a,b,d)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"./index":14}],17:[function(a,b){var c=a("./index");b.exports=function(a){return{componentDidMount:function(){for(var b in c.ListenerMethods)if(this[b]!==c.ListenerMethods[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=c.ListenerMethods[b]}this.listenToMany(a)},componentWillUnmount:c.ListenerMethods.stopListeningToAll}}},{"./index":14}],18:[function(a,b){var c=a("./utils");b.exports=function(a){var b={init:[],preEmit:[],shouldEmit:[]},d=function e(a){var d={};return a.mixins&&a.mixins.forEach(function(a){c.extend(d,e(a))}),c.extend(d,a),Object.keys(b).forEach(function(c){a.hasOwnProperty(c)&&b[c].push(a[c])}),d}(a);return b.init.length>1&&(d.init=function(){var a=arguments;b.init.forEach(function(b){b.apply(this,a)},this)}),b.preEmit.length>1&&(d.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&&(d.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&&(d[a]=b[a][0])}),d}},{"./utils":19}],19:[function(a,b,c){var d=c.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a};c.extend=function(a){if(!d(a))return a;for(var b,c,e=1,f=arguments.length;f>e;e++){b=arguments[e];for(c in b)if(Object.getOwnPropertyDescriptor&&Object.defineProperty){var g=Object.getOwnPropertyDescriptor(b,c);Object.defineProperty(a,c,g)}else a[c]=b[c]}return a},c.isFunction=function(a){return"function"==typeof a},c.EventEmitter=a("eventemitter3"),c.nextTick=function(a){setTimeout(a,0)},c.capitalize=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},c.callbackName=function(a){return"on"+c.capitalize(a)},c.object=function(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c},c.Promise=a("native-promise-only"),c.createPromise=function(a){return new c.Promise(a)},c.isArguments=function(a){return"object"==typeof a&&"callee"in a&&"number"==typeof a.length},c.throwIf=function(a,b){if(a)throw Error(b||a)}},{eventemitter3:1,"native-promise-only":2}]},{},[14])(14)}); | ||
!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(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[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:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,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(){}e.prototype._events=void 0,e.prototype.listeners=function(a){if(!this._events||!this._events[a])return[];if(this._events[a].fn)return[this._events[a].fn];for(var b=0,c=this._events[a].length,d=new Array(c);c>b;b++)d[b]=this._events[a][b].fn;return d},e.prototype.emit=function(a,b,c,d,e,f){if(!this._events||!this._events[a])return!1;var g,h,i=this._events[a],j=arguments.length;if("function"==typeof i.fn){switch(i.once&&this.removeListener(a,i.fn,!0),j){case 1:return i.fn.call(i.context),!0;case 2:return i.fn.call(i.context,b),!0;case 3:return i.fn.call(i.context,b,c),!0;case 4:return i.fn.call(i.context,b,c,d),!0;case 5:return i.fn.call(i.context,b,c,d,e),!0;case 6:return i.fn.call(i.context,b,c,d,e,f),!0}for(h=1,g=new Array(j-1);j>h;h++)g[h-1]=arguments[h];i.fn.apply(i.context,g)}else{var k,l=i.length;for(h=0;l>h;h++)switch(i[h].once&&this.removeListener(a,i[h].fn,!0),j){case 1:i[h].fn.call(i[h].context);break;case 2:i[h].fn.call(i[h].context,b);break;case 3:i[h].fn.call(i[h].context,b,c);break;default:if(!g)for(k=1,g=new Array(j-1);j>k;k++)g[k-1]=arguments[k];i[h].fn.apply(i[h].context,g)}}return!0},e.prototype.on=function(a,b,c){var e=new d(b,c||this);return this._events||(this._events={}),this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],e]:this._events[a].push(e):this._events[a]=e,this},e.prototype.once=function(a,b,c){var e=new d(b,c||this,!0);return this._events||(this._events={}),this._events[a]?this._events[a].fn?this._events[a]=[this._events[a],e]:this._events[a].push(e):this._events[a]=e,this},e.prototype.removeListener=function(a,b,c){if(!this._events||!this._events[a])return this;var d=this._events[a],e=[];if(b&&(d.fn&&(d.fn!==b||c&&!d.once)&&e.push(d),!d.fn))for(var f=0,g=d.length;g>f;f++)(d[f].fn!==b||c&&!d[f].once)&&e.push(d[f]);return e.length?this._events[a]=1===e.length?e[0]:e:delete this._events[a],this},e.prototype.removeAllListeners=function(a){return this._events?(a?delete this._events[a]:this._events={},this):this},e.prototype.off=e.prototype.removeListener,e.prototype.addListener=e.prototype.on,e.prototype.setMaxListeners=function(){return this},e.EventEmitter=e,e.EventEmitter2=e,e.EventEmitter3=e,b.exports=e},{}],2:[function(b,c,d){(function(b){!function(b,d,e){d[b]=d[b]||e(),"undefined"!=typeof c&&c.exports?c.exports=d[b]:"function"==typeof a&&a.amd&&a(function(){return d[b]})}("Promise","undefined"!=typeof b?b:this,function(){"use strict";function a(a,b){m.add(a,b),l||(l=o(m.drain))}function b(a){var b,c=typeof a;return null==a||"object"!=c&&"function"!=c||(b=a.then),"function"==typeof b?b:!1}function c(){for(var a=0;a<this.chain.length;a++)d(this,1===this.state?this.chain[a].success:this.chain[a].failure,this.chain[a]);this.chain.length=0}function d(a,c,d){var e,f;try{c===!1?d.reject(a.msg):(e=c===!0?a.msg:c.call(void 0,a.msg),e===d.promise?d.reject(TypeError("Promise-chain cycle")):(f=b(e))?f.call(e,d.resolve,d.reject):d.resolve(e))}catch(g){d.reject(g)}}function e(d){var g,i,j=this;if(!j.triggered){j.triggered=!0,j.def&&(j=j.def);try{(g=b(d))?(i=new h(j),g.call(d,function(){e.apply(i,arguments)},function(){f.apply(i,arguments)})):(j.msg=d,j.state=1,j.chain.length>0&&a(c,j))}catch(k){f.call(i||new h(j),k)}}}function f(b){var d=this;d.triggered||(d.triggered=!0,d.def&&(d=d.def),d.msg=b,d.state=2,d.chain.length>0&&a(c,d))}function g(a,b,c,d){for(var e=0;e<b.length;e++)!function(e){a.resolve(b[e]).then(function(a){c(e,a)},d)}(e)}function h(a){this.def=a,this.triggered=!1}function i(a){this.promise=a,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function j(b){if("function"!=typeof b)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var d=new i(this);this.then=function(b,e){var f={success:"function"==typeof b?b:!0,failure:"function"==typeof e?e:!1};return f.promise=new this.constructor(function(a,b){if("function"!=typeof a||"function"!=typeof b)throw TypeError("Not a function");f.resolve=a,f.reject=b}),d.chain.push(f),0!==d.state&&a(c,d),f.promise},this["catch"]=function(a){return this.then(void 0,a)};try{b.call(void 0,function(a){e.call(d,a)},function(a){f.call(d,a)})}catch(g){f.call(d,g)}}var k,l,m,n=Object.prototype.toString,o="undefined"!=typeof setImmediate?function(a){return setImmediate(a)}:setTimeout;try{Object.defineProperty({},"x",{}),k=function(a,b,c,d){return Object.defineProperty(a,b,{value:c,writable:!0,configurable:d!==!1})}}catch(p){k=function(a,b,c){return a[b]=c,a}}m=function(){function a(a,b){this.fn=a,this.self=b,this.next=void 0}var b,c,d;return{add:function(e,f){d=new a(e,f),c?c.next=d:b=d,c=d,d=void 0},drain:function(){var a=b;for(b=c=l=void 0;a;)a.fn.call(a.self),a=a.next}}}();var q=k({},"constructor",j,!1);return j.prototype=q,k(q,"__NPO__",0,!1),k(j,"resolve",function(a){var b=this;return a&&"object"==typeof a&&1===a.__NPO__?a:new b(function(b,c){if("function"!=typeof b||"function"!=typeof c)throw TypeError("Not a function");b(a)})}),k(j,"reject",function(a){return new this(function(b,c){if("function"!=typeof b||"function"!=typeof c)throw TypeError("Not a function");c(a)})}),k(j,"all",function(a){var b=this;return"[object Array]"!=n.call(a)?b.reject(TypeError("Not an array")):0===a.length?b.resolve([]):new b(function(c,d){if("function"!=typeof c||"function"!=typeof d)throw TypeError("Not a function");var e=a.length,f=Array(e),h=0;g(b,a,function(a,b){f[a]=b,++h===e&&c(f)},d)})}),k(j,"race",function(a){var b=this;return"[object Array]"!=n.call(a)?b.reject(TypeError("Not an array")):new b(function(c,d){if("function"!=typeof c||"function"!=typeof d)throw TypeError("Not a function");g(b,a,function(a,b){c(b)},d)})}),j})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(a,b,c){b.exports={}},{}],4:[function(a,b,c){c.createdStores=[],c.createdActions=[],c.reset=function(){for(;c.createdStores.length;)c.createdStores.pop();for(;c.createdActions.length;)c.createdActions.pop()}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./joins").instanceJoinCreator,f=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},g=function(a){var b={};for(var c in a){var e=a[c],h=f(e),i=g(h);b[c]=e;for(var j in i){var k=i[j];b[c+d.capitalize(j)]=k}}return b};b.exports={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},listenToMany:function(a){var b=g(a);for(var c in b){var e=d.callbackName(c),f=this[e]?e:this[c]?c:void 0;f&&this.listenTo(b[c],f,this[e+"Default"]||this[f+"Default"]||f)}},validateListening:function(a){return a===this?"Listener is not able to listen to itself":d.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"},listenTo:function(a,b,c){var e,f,g,h=this.subscriptions=this.subscriptions||[];return d.throwIf(this.validateListening(a)),this.fetchInitialState(a,c),e=a.listen(this[b]||b,this),f=function(){var a=h.indexOf(g);d.throwIf(-1===a,"Tried to remove listen already gone from subscriptions list!"),h.splice(a,1),e()},g={stop:f,listenable:a},h.push(g),g},stopListeningTo:function(a){for(var b,c=0,e=this.subscriptions||[];c<e.length;c++)if(b=e[c],b.listenable===a)return b.stop(),d.throwIf(-1!==e.indexOf(b),"Failed to remove listen from subscriptions list!"),!0;return!1},stopListeningToAll:function(){for(var a,b=this.subscriptions||[];a=b.length;)b[0].stop(),d.throwIf(b.length!==a-1,"Failed to remove listen from subscriptions list!")},fetchInitialState:function(a,b){b=b&&this[b]||b;var c=this;if(d.isFunction(b)&&d.isFunction(a.getInitialState)){var e=a.getInitialState();e&&d.isFunction(e.then)?e.then(function(){b.apply(c,arguments)}):b.call(this,e)}},joinTrailing:e("last"),joinLeading:e("first"),joinConcat:e("all"),joinStrict:e("strict")}},{"./joins":15,"./utils":19}],6:[function(a,b,c){var d=a("./utils"),e=a("./ListenerMethods");b.exports=d.extend({componentWillUnmount:e.stopListeningToAll},e)},{"./ListenerMethods":5,"./utils":19}],7:[function(a,b,c){var d=a("./utils");b.exports={preEmit:function(){},shouldEmit:function(){return!0},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)}},promise:function(a){var b=this,c=this.children.indexOf("completed")>=0&&this.children.indexOf("failed")>=0;if(!c)throw new Error('Publisher must have "completed" and "failed" child publishers');a.then(function(a){return b.completed(a)},function(a){return b.failed(a)})},listenAndPromise:function(a,b){var c=this;b=b||this,this.willCallPromise=(this.willCallPromise||0)+1;var d=this.listen(function(){if(!a)throw new Error("Expected a function returning a promise but got "+a);var d=arguments,e=a.apply(b,d);return c.promise.call(c,e)},b);return function(){c.willCallPromise--,d.call(c)}},trigger:function(){var a=arguments,b=this.preEmit.apply(this,a);a=void 0===b?a:d.isArguments(b)?b:[].concat(b),this.shouldEmit.apply(this,a)&&this.emitter.emit(this.eventLabel,a)},triggerAsync:function(){var a=arguments,b=this;d.nextTick(function(){b.trigger.apply(b,a)})},triggerPromise:function(){var a=this,b=arguments,c=this.children.indexOf("completed")>=0&&this.children.indexOf("failed")>=0,e=d.createPromise(function(e,f){if(a.willCallPromise)return void d.nextTick(function(){var c=a.promise;a.promise=function(b){return b.then(e,f),a.promise=c,a.promise.apply(a,arguments)},a.trigger.apply(a,b)});if(c)var g=a.completed.listen(function(a){g(),h(),e(a)}),h=a.failed.listen(function(a){g(),h(),f(a)});a.triggerAsync.apply(a,b),c||e()});return e}}},{"./utils":19}],8:[function(a,b,c){b.exports={}},{}],9:[function(a,b,c){b.exports=function(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}},{}],10:[function(a,b,c){var d=a("./index"),e=a("./utils");b.exports=function(a,b){return{getInitialState:function(){return e.isFunction(a.getInitialState)?void 0===b?a.getInitialState():e.object([b],[a.getInitialState()]):{}},componentDidMount:function(){e.extend(this,d.ListenerMethods);var c=this,f=void 0===b?this.setState:function(a){("undefined"==typeof c.isMounted||c.isMounted()===!0)&&c.setState(e.object([b],[a]))};this.listenTo(a,f)},componentWillUnmount:d.ListenerMixin.componentWillUnmount}}},{"./index":14,"./utils":19}],11:[function(a,b,c){var d=a("./index"),e=a("./utils");b.exports=function(a,b,c){return c=e.isFunction(b)?b:c,{getInitialState:function(){if(e.isFunction(a.getInitialState)){if(e.isFunction(b))return c.call(this,a.getInitialState());var d=c.call(this,a.getInitialState());return d?e.object([b],[d]):{}}return{}},componentDidMount:function(){e.extend(this,d.ListenerMethods);var f=this,g=function(a){if(e.isFunction(b))f.setState(c.call(f,a));else{var d=c.call(f,a);f.setState(e.object([b],[d]))}};this.listenTo(a,g)},componentWillUnmount:d.ListenerMixin.componentWillUnmount}}},{"./index":14,"./utils":19}],12:[function(a,b,c){var d=a("./utils"),e=a("./index"),f=a("./Keep"),g={preEmit:1,shouldEmit:1},h=function(a){a=a||{},d.isObject(a)||(a={actionName:a});for(var b in e.ActionMethods)if(!g[b]&&e.PublisherMethods[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(!g[c]&&e.PublisherMethods[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 i=0,j={};i<a.children.length;i++){var k=a.children[i];j[k]=h(k)}var l=d.extend({eventLabel:"action",emitter:new d.EventEmitter,_isAction:!0},e.PublisherMethods,e.ActionMethods,a),m=function(){return m[m.sync?"trigger":"triggerPromise"].apply(m,arguments)};return d.extend(m,j,l),f.createdActions.push(m),m};b.exports=h},{"./Keep":4,"./index":14,"./utils":19}],13:[function(a,b,c){var d=a("./utils"),e=a("./index"),f=a("./Keep"),g=a("./mixer"),h={preEmit:1,shouldEmit:1},i=a("./bindMethods");b.exports=function(a){function b(){var b,c=0;if(this.subscriptions=[],this.emitter=new d.EventEmitter,this.eventLabel="change",i(this,a),this.init&&d.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 e.StoreMethods)if(!h[c]&&(e.PublisherMethods[c]||e.ListenerMethods[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 j in a)if(!h[j]&&(e.PublisherMethods[j]||e.ListenerMethods[j]))throw new Error("Cannot override API method "+j+" in store creation. Use another method name or override it on Reflux.PublisherMethods / Reflux.ListenerMethods instead.");a=g(a),d.extend(b.prototype,e.ListenerMethods,e.PublisherMethods,e.StoreMethods,a);var k=new b;return f.createdStores.push(k),k}},{"./Keep":4,"./bindMethods":9,"./index":14,"./mixer":18,"./utils":19}],14:[function(a,b,c){c.ActionMethods=a("./ActionMethods"),c.ListenerMethods=a("./ListenerMethods"),c.PublisherMethods=a("./PublisherMethods"),c.StoreMethods=a("./StoreMethods"),c.createAction=a("./createAction"),c.createStore=a("./createStore"),c.connect=a("./connect"),c.connectFilter=a("./connectFilter"),c.ListenerMixin=a("./ListenerMixin"),c.listenTo=a("./listenTo"),c.listenToMany=a("./listenToMany");var d=a("./joins").staticJoinCreator;c.joinTrailing=c.all=d("last"),c.joinLeading=d("first"),c.joinStrict=d("strict"),c.joinConcat=d("all");var e=a("./utils");c.EventEmitter=e.EventEmitter,c.Promise=e.Promise,c.createActions=function(a){var b={};for(var d in a)if(a.hasOwnProperty(d)){var f=a[d],g=e.isObject(f)?d:f;b[g]=c.createAction(f)}return b},c.setEventEmitter=function(b){var d=a("./utils");c.EventEmitter=d.EventEmitter=b},c.setPromise=function(b){var d=a("./utils");c.Promise=d.Promise=b},c.setPromiseFactory=function(b){var c=a("./utils");c.createPromise=b},c.nextTick=function(b){var c=a("./utils");c.nextTick=b},c.__keep=a("./Keep"),Function.prototype.bind||console.error("Function.prototype.bind not available. ES5 shim required. https://github.com/spoike/refluxjs#es5")},{"./ActionMethods":3,"./Keep":4,"./ListenerMethods":5,"./ListenerMixin":6,"./PublisherMethods":7,"./StoreMethods":8,"./connect":10,"./connectFilter":11,"./createAction":12,"./createStore":13,"./joins":15,"./listenTo":16,"./listenToMany":17,"./utils":19}],15:[function(a,b,c){function d(a,b,c){return function(){var d,e=c.subscriptions,f=e?e.indexOf(a):-1;for(i.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 e(a){a.listenablesEmitted=new Array(a.numberOfListenables),a.args=new Array(a.numberOfListenables)}function f(a,b){return function(){var c=h.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;g(b)}}function g(a){for(var b=0;b<a.numberOfListenables;b++)if(!a.listenablesEmitted[b])return;a.callback.apply(a.listener,a.args),e(a)}var h=Array.prototype.slice,i=a("./utils"),j=a("./createStore"),k={strict:"joinStrict",first:"joinLeading",last:"joinTrailing",all:"joinConcat"};c.staticJoinCreator=function(a){return function(){var b=h.call(arguments);return j({init:function(){this[k[a]].apply(this,b.concat("triggerAsync"))}})}},c.instanceJoinCreator=function(a){return function(){i.throwIf(arguments.length<3,"Cannot create a join with less than 2 listenables!");var b,c,g=h.call(arguments),j=g.pop(),k=g.length,l={numberOfListenables:k,callback:this[j]||j,listener:this,strategy:a},m=[];for(b=0;k>b;b++)i.throwIf(this.validateListening(g[b]));for(b=0;k>b;b++)m.push(g[b].listen(f(b,l),this));return e(l),c={listenable:g},c.stop=d(c,m,this),this.subscriptions=(this.subscriptions||[]).concat(c),c}}},{"./createStore":13,"./utils":19}],16:[function(a,b,c){var d=a("./index");b.exports=function(a,b,c){return{componentDidMount:function(){for(var e in d.ListenerMethods)if(this[e]!==d.ListenerMethods[e]){if(this[e])throw"Can't have other property '"+e+"' when using Reflux.listenTo!";this[e]=d.ListenerMethods[e]}this.listenTo(a,b,c)},componentWillUnmount:d.ListenerMethods.stopListeningToAll}}},{"./index":14}],17:[function(a,b,c){var d=a("./index");b.exports=function(a){return{componentDidMount:function(){for(var b in d.ListenerMethods)if(this[b]!==d.ListenerMethods[b]){if(this[b])throw"Can't have other property '"+b+"' when using Reflux.listenToMany!";this[b]=d.ListenerMethods[b]}this.listenToMany(a)},componentWillUnmount:d.ListenerMethods.stopListeningToAll}}},{"./index":14}],18:[function(a,b,c){var d=a("./utils");b.exports=function(a){var b={init:[],preEmit:[],shouldEmit:[]},c=function e(a){var c={};return a.mixins&&a.mixins.forEach(function(a){d.extend(c,e(a))}),d.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}},{"./utils":19}],19:[function(a,b,c){var d=c.isObject=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a};c.extend=function(a){if(!d(a))return a;for(var b,c,e=1,f=arguments.length;f>e;e++){b=arguments[e];for(c in b)if(Object.getOwnPropertyDescriptor&&Object.defineProperty){var g=Object.getOwnPropertyDescriptor(b,c);Object.defineProperty(a,c,g)}else a[c]=b[c]}return a},c.isFunction=function(a){return"function"==typeof a},c.EventEmitter=a("eventemitter3"),c.nextTick=function(a){setTimeout(a,0)},c.capitalize=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},c.callbackName=function(a){return"on"+c.capitalize(a)},c.object=function(a,b){for(var c={},d=0;d<a.length;d++)c[a[d]]=b[d];return c},c.Promise=a("native-promise-only"),c.createPromise=function(a){return new c.Promise(a)},c.isArguments=function(a){return"object"==typeof a&&"callee"in a&&"number"==typeof a.length},c.throwIf=function(a,b){if(a)throw Error(b||a)}},{eventemitter3:1,"native-promise-only":2}]},{},[14])(14)}); |
@@ -21,3 +21,3 @@ module.exports = function(grunt) { | ||
options: { | ||
bundleOptions: { | ||
browserifyOptions: { | ||
standalone: 'Reflux' | ||
@@ -24,0 +24,0 @@ } |
{ | ||
"name": "reflux", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux", | ||
@@ -23,28 +23,31 @@ "main": "index.js", | ||
"eventemitter3": "^0.1.2", | ||
"native-promise-only": "^0.7.6-a" | ||
"native-promise-only": "^0.7.8-a" | ||
}, | ||
"devDependencies": { | ||
"benchmark": "^1.0.0", | ||
"browserify": "^5.11.1", | ||
"chai": "^1.9.1", | ||
"chai-as-promised": "^4.1.1", | ||
"browserify": "~10.2.3", | ||
"chai": "~3.0.0", | ||
"chai-as-promised": "^5.0.0", | ||
"grunt": "^0.4.5", | ||
"grunt-browserify": "^2.1.4", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-browserify": "3.8.0", | ||
"grunt-contrib-jshint": "0.11.2", | ||
"grunt-contrib-uglify": "^0.5.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-mocha-test": "^0.11.0", | ||
"grunt-karma": "~0.11.0", | ||
"grunt-mocha-test": "~0.12.7", | ||
"karma": "~0.12.36", | ||
"karma-browserify": "^4.2.1", | ||
"karma-commonjs": "0.0.13", | ||
"karma-mocha": "^0.1.9", | ||
"karma-phantomjs-launcher": "~0.2.0", | ||
"karma-sauce-launcher": "^0.2.10", | ||
"karma-spec-reporter": "^0.0.19", | ||
"matchdep": "^0.3.0", | ||
"mocha": "^1.21.3", | ||
"mocha": "~2.2.5", | ||
"q": "^1.0.1", | ||
"sinon": "^1.10.3", | ||
"karma-commonjs": "0.0.11", | ||
"karma": "0.12.23", | ||
"karma-mocha": "^0.1.9", | ||
"karma-phantomjs-launcher": "^0.1.4", | ||
"karma-bro": "^0.7.0", | ||
"karma-spec-reporter": "0.0.13", | ||
"grunt-karma": "^0.9.0", | ||
"karma-sauce-launcher": "^0.2.10" | ||
"sinon": "^1.10.3" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=0.12.2 <0.14.0" | ||
} | ||
} |
@@ -12,3 +12,3 @@ # RefluxJS | ||
You can read an overview of Flux [here](http://facebook.github.io/react/docs/flux-overview.html), however the gist of it is to introduce a more functional programming style architecture by eschewing MVC like pattern and adopting a single data flow pattern. | ||
You can read an overview of Flux [here](https://facebook.github.io/flux/docs/overview.html), however the gist of it is to introduce a more functional programming style architecture by eschewing MVC like pattern and adopting a single data flow pattern. | ||
@@ -26,2 +26,10 @@ ``` | ||
For questions please use the following communication channels: | ||
1. [StackOverflow with the `refluxjs` tag](http://stackoverflow.com/questions/tagged/refluxjs) | ||
2. [`#reflux` channel](https://reactiflux.slack.com/messages/reflux/) on Reactiflux Slack group. [Sign up here](http://reactiflux.com/) for an account. | ||
3. [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/spoike/refluxjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | ||
Please only use the [issue tracker](https://github.com/spoike/refluxjs/issues) for bugs and feature requests only. | ||
## Content | ||
@@ -74,2 +82,3 @@ | ||
* [Another Todo Project with a Python backend](https://github.com/limelights/todo-reflux) by limelights | ||
* [Sample app with authentication, permissions, sidebar and editable collection](https://github.com/VladimirPal/react-flux-backbone) | ||
@@ -415,2 +424,30 @@ [Back to top](#content) | ||
#### Listenables and asynchronous actions | ||
If `options.children` is set, as in the example below, you can use `onActionSubaction` to add a listener to the child action. For example: | ||
```javascript | ||
var Actions = Reflux.createActions({ | ||
"load": {children: ["completed", "failed"]} | ||
}); | ||
function handleLoad(){ | ||
console.log("The on" + Action + Subaction + " handler was called"); | ||
}; | ||
var Store = Reflux.createStore({ | ||
listenables: Actions, | ||
onLoad: function() { | ||
handleLoad("Load"); | ||
}, | ||
onLoadCompleted: function() { | ||
handleLoad("Load", "Completed"); | ||
}, | ||
onLoadFailed: function() { | ||
handleLoad("Load", "Failed"); | ||
} | ||
}); | ||
``` | ||
### Listening to changes in data store | ||
@@ -455,3 +492,3 @@ | ||
var Status = React.createClass({ | ||
initialize: function() { }, | ||
getInitialState: function() { }, | ||
onStatusChange: function(status) { | ||
@@ -534,2 +571,20 @@ this.setState({ | ||
The `Reflux.connect()` mixin will check the store for a `getInitialState` method. If found it will set the components `getInitialState` | ||
```javascript | ||
var statusStore = Reflux.createStore({ | ||
getInitialState: function() { | ||
return {currentStatus: "open"} | ||
} | ||
}); | ||
var Status = React.createClass({ | ||
mixins: [Reflux.connect(statusStore,"currentStatus")], | ||
render: function() { | ||
// render using `this.state.currentStatus` | ||
// this.state.currentStatus === "open" | ||
} | ||
}); | ||
``` | ||
#### Using Reflux.connectFilter | ||
@@ -536,0 +591,0 @@ |
@@ -17,3 +17,7 @@ var Reflux = require('./index'), | ||
_.extend(this,Reflux.ListenerMethods); | ||
var me = this, cb = (key === undefined ? this.setState : function(v){me.setState(_.object([key],[v]));}); | ||
var me = this, cb = (key === undefined ? this.setState : function(v){ | ||
if (typeof me.isMounted === "undefined" || me.isMounted() === true) { | ||
me.setState(_.object([key],[v])); | ||
} | ||
}); | ||
this.listenTo(listenable,cb); | ||
@@ -20,0 +24,0 @@ }, |
@@ -49,3 +49,3 @@ /* | ||
var o={}, i=0; | ||
for(;i<keys.length;i++){ | ||
for(;i < keys.length; i++){ | ||
o[keys[i]] = vals[i]; | ||
@@ -52,0 +52,0 @@ } |
Sorry, the diff of this file is not supported yet
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
144150
2207
777
3
+ Addedacorn@5.7.4(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedast-types@0.9.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase62@1.2.8(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedenvify@3.4.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjstransform@11.0.3(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addednative-promise-only@0.7.8-a(transitive)
+ Addedobject-assign@2.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedq@1.5.1(transitive)
+ Addedreact@0.13.3(transitive)
+ Addedrecast@0.11.23(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsource-map@0.4.40.5.7(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removednative-promise-only@0.7.6-a(transitive)
Updatednative-promise-only@^0.7.8-a