Comparing version 2.8.0 to 2.9.0
@@ -12,2 +12,9 @@ # Changelog | ||
## 2.9.0 | ||
- [New Feature] | ||
- Extra props set on FluxComponent will be injected into children. This lets you nest FluxComponents, so store getters on an inner FluxComponent can use props retrieved by an outer FluxComponent. | ||
- FluxComponent no longer wraps a single child in a `span`. It only wraps if there are multiple children. | ||
- [Documentation] | ||
- Add sections clarifying how to access flux instance (e.g. to perform actions) using FluxMixin/FluxComponent | ||
## 2.8.0 | ||
@@ -14,0 +21,0 @@ - [New Feature] |
@@ -60,4 +60,2 @@ var Flummox = | ||
var _toArray = function (arr) { return Array.isArray(arr) ? arr : Array.from(arr); }; | ||
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; | ||
@@ -111,3 +109,3 @@ | ||
var store = _applyConstructor(_Store, _toArray(constructorArgs)); | ||
var store = _applyConstructor(_Store, constructorArgs); | ||
var token = this.dispatcher.register(store.handler.bind(store)); | ||
@@ -119,2 +117,4 @@ | ||
this._stores[key] = store; | ||
return store; | ||
}, | ||
@@ -147,3 +147,3 @@ writable: true, | ||
var actions = _applyConstructor(_Actions, _toArray(constructorArgs)); | ||
var actions = _applyConstructor(_Actions, constructorArgs); | ||
actions.dispatch = this.dispatch.bind(this); | ||
@@ -153,2 +153,4 @@ actions.dispatchAsync = this.dispatchAsync.bind(this); | ||
this._actions[key] = actions; | ||
return actions; | ||
}, | ||
@@ -169,5 +171,5 @@ writable: true, | ||
if (!actions) return; | ||
return actions.getConstants(); | ||
if (!actions) { | ||
return; | ||
}return actions.getConstants(); | ||
}, | ||
@@ -346,3 +348,3 @@ writable: true, | ||
var assign = _interopRequire(__webpack_require__(6)); | ||
var assign = _interopRequire(__webpack_require__(7)); | ||
@@ -415,5 +417,5 @@ var Store = (function (EventEmitter) { | ||
if (typeof handler !== "function") return; | ||
this._handlers[actionId] = handler.bind(this); | ||
if (typeof handler !== "function") { | ||
return; | ||
}this._handlers[actionId] = handler.bind(this); | ||
}, | ||
@@ -490,4 +492,5 @@ writable: true, | ||
if (typeof _handler !== "function") return; | ||
this._performHandler(_handler, body); | ||
if (typeof _handler !== "function") { | ||
return; | ||
}this._performHandler(_handler, body); | ||
}, | ||
@@ -561,3 +564,3 @@ writable: true, | ||
var uniqueId = _interopRequire(__webpack_require__(7)); | ||
var uniqueId = _interopRequire(__webpack_require__(6)); | ||
@@ -645,5 +648,5 @@ var Actions = (function () { | ||
if (typeof body === "undefined") return; | ||
this.dispatch(actionId, body, args); | ||
if (typeof body === "undefined") { | ||
return; | ||
}this.dispatch(actionId, body, args); | ||
}, | ||
@@ -1187,35 +1190,3 @@ writable: true, | ||
function ToObject(val) { | ||
if (val == null) { | ||
throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
} | ||
return Object(val); | ||
} | ||
module.exports = Object.assign || function (target, source) { | ||
var from; | ||
var keys; | ||
var to = ToObject(target); | ||
for (var s = 1; s < arguments.length; s++) { | ||
from = arguments[s]; | ||
keys = Object.keys(Object(from)); | ||
for (var i = 0; i < keys.length; i++) { | ||
to[keys[i]] = from[keys[i]]; | ||
} | ||
} | ||
return to; | ||
}; | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var count = 0; | ||
@@ -1274,2 +1245,34 @@ | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
function ToObject(val) { | ||
if (val == null) { | ||
throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
} | ||
return Object(val); | ||
} | ||
module.exports = Object.assign || function (target, source) { | ||
var from; | ||
var keys; | ||
var to = ToObject(target); | ||
for (var s = 1; s < arguments.length; s++) { | ||
from = arguments[s]; | ||
keys = Object.keys(Object(from)); | ||
for (var i = 0; i < keys.length; i++) { | ||
to[keys[i]] = from[keys[i]]; | ||
} | ||
} | ||
return to; | ||
}; | ||
/***/ }, | ||
/* 8 */ | ||
@@ -1276,0 +1279,0 @@ /***/ function(module, exports, __webpack_require__) { |
@@ -1,1 +0,1 @@ | ||
var Flummox=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function i(t){return t.prototype.constructor.name}var r=function(t){return t&&t.__esModule?t["default"]:t},s=function(t,e){var n=Object.create(t.prototype),i=t.apply(n,e);return null==i||"object"!=typeof i&&"function"!=typeof i?n:i},a=function(t){return Array.isArray(t)?t:Array.from(t)},o=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},c=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},h=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=r(n(1)),l=r(n(2)),f=n(3).Dispatcher,p=r(n(4)),d=function(t){function e(){h(this,e),this.dispatcher=new f,this._stores={},this._actions={},this.getConstants=this.getActionIds,this.dehydrate=this.serialize,this.hydrate=this.deserialize}return c(e,t),o(e,null,{createStore:{value:function(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;n>o;o++)r[o-2]=arguments[o];if(!(e.prototype instanceof u)){var c=i(e);throw new Error("You've attempted to create a store from the class "+c+", which does not have the base Store class in its prototype chain. Make sure "+("you're using the `extends` keyword: `class "+c+" extends ")+"Store { ... }`")}if(this._stores.hasOwnProperty(t)&&this._stores[t])throw new Error("You've attempted to create multiple stores with key "+t+". Keys must be unique.");var h=s(e,a(r)),l=this.dispatcher.register(h.handler.bind(h));h._waitFor=this.waitFor.bind(this),h._token=l,this._stores[t]=h},writable:!0,configurable:!0},getStore:{value:function(t){return this._stores.hasOwnProperty(t)?this._stores[t]:void 0},writable:!0,configurable:!0},createActions:{value:function(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;n>o;o++)r[o-2]=arguments[o];if(!(e.prototype instanceof l)&&e!==l){var c=i(e);throw new Error("You've attempted to create actions from the class "+c+", which does not have the base Actions class in its prototype chain. Make "+("sure you're using the `extends` keyword: `class "+c+" ")+"extends Actions { ... }`")}if(this._actions.hasOwnProperty(t)&&this._actions[t])throw new Error("You've attempted to create multiple actions with key "+t+". Keys must be unique.");var h=s(e,a(r));h.dispatch=this.dispatch.bind(this),h.dispatchAsync=this.dispatchAsync.bind(this),this._actions[t]=h},writable:!0,configurable:!0},getActions:{value:function(t){return this._actions.hasOwnProperty(t)?this._actions[t]:void 0},writable:!0,configurable:!0},getActionIds:{value:function(t){var e=this.getActions(t);if(e)return e.getConstants()},writable:!0,configurable:!0},dispatch:{value:function(t,e){this.dispatcher.dispatch({actionId:t,body:e})},writable:!0,configurable:!0},dispatchAsync:{value:function(t,e,n){var i=this,r={actionId:t,async:"begin"};return n&&(r.actionArgs=n),this.dispatcher.dispatch(r),e.then(function(e){i.dispatcher.dispatch({actionId:t,body:e,async:"success"})},function(e){return i.dispatcher.dispatch({actionId:t,error:e,async:"failure"}),Promise.reject(e)})},writable:!0,configurable:!0},waitFor:{value:function(t){Array.isArray(t)||(t=[t]);var e=function(t){return t instanceof u?t._token:t},n=t.map(e);this.dispatcher.waitFor(n)},writable:!0,configurable:!0},serialize:{value:function n(){var t={};for(var e in this._stores)if(this._stores.hasOwnProperty(e)){var i=this._stores[e],n=i.constructor.serialize;if("function"==typeof n){var r=n(i.state);if("string"!=typeof r){var s=i.constructor.name;console.warn("The store with key '"+e+"' was not serialized because the static "+("method `"+s+".serialize()` returned a non-string with type ")+("'"+typeof r+"'."))}if(t[e]=r,"function"!=typeof i.constructor.deserialize){var s=i.constructor.name;console.warn("The class `"+s+"` has a `serialize()` method, but no corresponding `deserialize()` method.")}}}return JSON.stringify(t)},writable:!0,configurable:!0},deserialize:{value:function r(t){var e=void 0;try{e=JSON.parse(t)}catch(n){var i=this.constructor.name;throw new Error("Invalid value passed to `"+i+"#deserialize()`: "+t)}for(var s in this._stores)if(this._stores.hasOwnProperty(s)){var a=this._stores[s],r=a.constructor.deserialize;if("function"==typeof r){var o=e[s],c=r(o);if(a.replaceState(c),"function"!=typeof a.constructor.serialize){var i=a.constructor.name;console.warn("The class `"+i+"` has a `deserialize()` method, but no corresponding `serialize()` method.")}}}},writable:!0,configurable:!0}}),e}(p);e["default"]=d;var v=d;e.Flux=d,e.Flummox=v,e.Store=u,e.Actions=l,Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,n){"use strict";function i(t){return"function"==typeof t?t._id:t}var r=function(t){return t&&t.__esModule?t["default"]:t},s=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},a=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},c=r(n(4)),h=r(n(6)),u=function(t){function e(){o(this,e),this.state=void 0,this._handlers={},this._asyncHandlers={}}return a(e,t),s(e,null,{getState:{value:function(){return h({},this.state)},writable:!0,configurable:!0},setState:{value:function(t){"undefined"==typeof this.state&&(this.state={}),this._isHandlingDispatch?(this._pendingState=h(this._pendingState,t),this._emitChangeAfterHandlingDispatch=!0):(console.warn("Store#setState() called from outside an action handler. This is likely a mistake. Flux stores should manage their own state."),this.state=h({},this.state,t),this.emit("change"))},writable:!0,configurable:!0},replaceState:{value:function(t){"undefined"==typeof this.state&&(this.state={}),this._isHandlingDispatch?(this._pendingState=h({},t),this._emitChangeAfterHandlingDispatch=!0):(this.state=h({},t),this.emit("change"))},writable:!0,configurable:!0},register:{value:function(t,e){t=i(t),"function"==typeof e&&(this._handlers[t]=e.bind(this))},writable:!0,configurable:!0},registerAsync:{value:function(t,e,n,r){t=i(t);var s={begin:e,success:n,failure:r};for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];"function"==typeof o?s[a]=o.bind(this):delete s[a]}this._asyncHandlers[t]=s},writable:!0,configurable:!0},waitFor:{value:function(t){this._waitFor(t)},writable:!0,configurable:!0},handler:{value:function(t){var e=t.body,n=t.actionId,i=t.async,r=t.actionArgs,s=t.error,a=this._handlers[n],o=this._asyncHandlers[n]&&this._asyncHandlers[n][i];if(i)switch(i){case"begin":return void("function"==typeof o&&this._performHandler.apply(this,[o].concat(r)));case"failure":return void("function"==typeof o&&this._performHandler(o,s));case"success":"function"==typeof o&&(a=o);break;default:return}"function"==typeof a&&this._performHandler(a,e)},writable:!0,configurable:!0},_performHandler:{value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;e>i;i++)n[i-1]=arguments[i];this._isHandlingDispatch=!0,this._pendingState=h({},this.state),this._emitChangeAfterHandlingDispatch=!1;try{t.apply(this,n)}finally{this._emitChangeAfterHandlingDispatch&&(this.state=this._pendingState,this.emit("change")),this._isHandlingDispatch=!1,this._pendingState={},this._emitChangeAfterHandlingDispatch=!1}},writable:!0,configurable:!0}}),e}(c);t.exports=u},function(t,e,n){"use strict";function i(t){return t&&"function"==typeof t.then}var r=function(t){return t&&t.__esModule?t["default"]:t},s=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=r(n(7)),c=function(){function t(){a(this,t),this._baseId=o();for(var e=this._getActionMethodNames(),n=0;n<e.length;n++){var i=e[n];this._wrapAction(i)}this.getConstants=this.getActionIds}return s(t,null,{getActionIds:{value:function(){var t=this;return this._getActionMethodNames().reduce(function(e,n){return e[n]=t[n]._id,e},{})},writable:!0,configurable:!0},_getActionMethodNames:{value:function(){var t=this;return Object.getOwnPropertyNames(this.constructor.prototype).filter(function(e){return"constructor"!==e&&"function"==typeof t[e]})},writable:!0,configurable:!0},_wrapAction:{value:function(t){var e=this,n=this[t],r=this._createActionId(t),s=function(){for(var s=arguments.length,a=Array(s),o=0;s>o;o++)a[o]=arguments[o];var c=n.apply(e,a);if(i(c)){var h=c;return e._dispatchAsync(r,h,a,t)}return e._dispatch(r,c,a,t)};s._id=r,this[t]=s},writable:!0,configurable:!0},_createActionId:{value:function(t){return""+this._baseId+"-"+t},writable:!0,configurable:!0},_dispatch:{value:function(t,e,n,i){if(!this.dispatch)throw new ReferenceError("You've attempted to perform the action "+(""+this.constructor.name+"#"+i+", but it hasn't been added ")+"to a Flux instance.");"undefined"!=typeof e&&this.dispatch(t,e,n)},writable:!0,configurable:!0},_dispatchAsync:{value:function(t,e,n,i){if(!this.dispatchAsync)throw new ReferenceError("You've attempted to perform the asynchronous action "+(""+this.constructor.name+"#"+i+", but it hasn't been added ")+"to a Flux instance.");return this.dispatchAsync(t,e,n)},writable:!0,configurable:!0}}),t}();t.exports=c},function(t,e,n){t.exports.Dispatcher=n(5)},function(t){"use strict";function e(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function n(){}n.prototype._events=void 0,n.prototype.listeners=function(t){if(!this._events||!this._events[t])return[];if(this._events[t].fn)return[this._events[t].fn];for(var e=0,n=this._events[t].length,i=new Array(n);n>e;e++)i[e]=this._events[t][e].fn;return i},n.prototype.emit=function(t,e,n,i,r,s){if(!this._events||!this._events[t])return!1;var a,o,c=this._events[t],h=arguments.length;if("function"==typeof c.fn){switch(c.once&&this.removeListener(t,c.fn,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,i),!0;case 5:return c.fn.call(c.context,e,n,i,r),!0;case 6:return c.fn.call(c.context,e,n,i,r,s),!0}for(o=1,a=new Array(h-1);h>o;o++)a[o-1]=arguments[o];c.fn.apply(c.context,a)}else{var u,l=c.length;for(o=0;l>o;o++)switch(c[o].once&&this.removeListener(t,c[o].fn,!0),h){case 1:c[o].fn.call(c[o].context);break;case 2:c[o].fn.call(c[o].context,e);break;case 3:c[o].fn.call(c[o].context,e,n);break;default:if(!a)for(u=1,a=new Array(h-1);h>u;u++)a[u-1]=arguments[u];c[o].fn.apply(c[o].context,a)}}return!0},n.prototype.on=function(t,n,i){var r=new e(n,i||this);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],r]:this._events[t].push(r):this._events[t]=r,this},n.prototype.once=function(t,n,i){var r=new e(n,i||this,!0);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],r]:this._events[t].push(r):this._events[t]=r,this},n.prototype.removeListener=function(t,e,n){if(!this._events||!this._events[t])return this;var i=this._events[t],r=[];if(e&&(i.fn&&(i.fn!==e||n&&!i.once)&&r.push(i),!i.fn))for(var s=0,a=i.length;a>s;s++)(i[s].fn!==e||n&&!i[s].once)&&r.push(i[s]);return r.length?this._events[t]=1===r.length?r[0]:r:delete this._events[t],this},n.prototype.removeAllListeners=function(t){return this._events?(t?delete this._events[t]:this._events={},this):this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prototype.setMaxListeners=function(){return this},n.EventEmitter=n,n.EventEmitter2=n,n.EventEmitter3=n,t.exports=n},function(t,e,n){"use strict";function i(){this.$Dispatcher_callbacks={},this.$Dispatcher_isPending={},this.$Dispatcher_isHandled={},this.$Dispatcher_isDispatching=!1,this.$Dispatcher_pendingPayload=null}var r=n(8),s=1,a="ID_";i.prototype.register=function(t){var e=a+s++;return this.$Dispatcher_callbacks[e]=t,e},i.prototype.unregister=function(t){r(this.$Dispatcher_callbacks[t],"Dispatcher.unregister(...): `%s` does not map to a registered callback.",t),delete this.$Dispatcher_callbacks[t]},i.prototype.waitFor=function(t){r(this.$Dispatcher_isDispatching,"Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var e=0;e<t.length;e++){var n=t[e];this.$Dispatcher_isPending[n]?r(this.$Dispatcher_isHandled[n],"Dispatcher.waitFor(...): Circular dependency detected while waiting for `%s`.",n):(r(this.$Dispatcher_callbacks[n],"Dispatcher.waitFor(...): `%s` does not map to a registered callback.",n),this.$Dispatcher_invokeCallback(n))}},i.prototype.dispatch=function(t){r(!this.$Dispatcher_isDispatching,"Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch."),this.$Dispatcher_startDispatching(t);try{for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]||this.$Dispatcher_invokeCallback(e)}finally{this.$Dispatcher_stopDispatching()}},i.prototype.isDispatching=function(){return this.$Dispatcher_isDispatching},i.prototype.$Dispatcher_invokeCallback=function(t){this.$Dispatcher_isPending[t]=!0,this.$Dispatcher_callbacks[t](this.$Dispatcher_pendingPayload),this.$Dispatcher_isHandled[t]=!0},i.prototype.$Dispatcher_startDispatching=function(t){for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]=!1,this.$Dispatcher_isHandled[e]=!1;this.$Dispatcher_pendingPayload=t,this.$Dispatcher_isDispatching=!0},i.prototype.$Dispatcher_stopDispatching=function(){this.$Dispatcher_pendingPayload=null,this.$Dispatcher_isDispatching=!1},t.exports=i},function(t){"use strict";function e(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t){for(var n,i,r=e(t),s=1;s<arguments.length;s++){n=arguments[s],i=Object.keys(Object(n));for(var a=0;a<i.length;a++)r[i[a]]=n[i[a]]}return r}},function(t){"use strict";var e=0,n=t.exports=function(t){t=t||{};var n=t.prefix,i=t.suffix,r=++e*(t.multiplier||1);return null==n&&(n=""),null==i&&(i=""),String(n)+r+String(i)};n.reset=function(){return e=0}},function(t){"use strict";var e=function(t,e,n,i,r,s,a,o){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[n,i,r,s,a,o],u=0;c=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return h[u++]}))}throw c.framesToPop=1,c}};t.exports=e}]); | ||
var Flummox=function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function i(t){return t.prototype.constructor.name}var r=function(t){return t&&t.__esModule?t["default"]:t},s=function(t,e){var n=Object.create(t.prototype),i=t.apply(n,e);return null==i||"object"!=typeof i&&"function"!=typeof i?n:i},a=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},o=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},c=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},h=r(n(1)),u=r(n(2)),l=n(3).Dispatcher,f=r(n(4)),p=function(t){function e(){c(this,e),this.dispatcher=new l,this._stores={},this._actions={},this.getConstants=this.getActionIds,this.dehydrate=this.serialize,this.hydrate=this.deserialize}return o(e,t),a(e,null,{createStore:{value:function(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),a=2;n>a;a++)r[a-2]=arguments[a];if(!(e.prototype instanceof h)){var o=i(e);throw new Error("You've attempted to create a store from the class "+o+", which does not have the base Store class in its prototype chain. Make sure "+("you're using the `extends` keyword: `class "+o+" extends ")+"Store { ... }`")}if(this._stores.hasOwnProperty(t)&&this._stores[t])throw new Error("You've attempted to create multiple stores with key "+t+". Keys must be unique.");var c=s(e,r),u=this.dispatcher.register(c.handler.bind(c));return c._waitFor=this.waitFor.bind(this),c._token=u,this._stores[t]=c,c},writable:!0,configurable:!0},getStore:{value:function(t){return this._stores.hasOwnProperty(t)?this._stores[t]:void 0},writable:!0,configurable:!0},createActions:{value:function(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),a=2;n>a;a++)r[a-2]=arguments[a];if(!(e.prototype instanceof u)&&e!==u){var o=i(e);throw new Error("You've attempted to create actions from the class "+o+", which does not have the base Actions class in its prototype chain. Make "+("sure you're using the `extends` keyword: `class "+o+" ")+"extends Actions { ... }`")}if(this._actions.hasOwnProperty(t)&&this._actions[t])throw new Error("You've attempted to create multiple actions with key "+t+". Keys must be unique.");var c=s(e,r);return c.dispatch=this.dispatch.bind(this),c.dispatchAsync=this.dispatchAsync.bind(this),this._actions[t]=c,c},writable:!0,configurable:!0},getActions:{value:function(t){return this._actions.hasOwnProperty(t)?this._actions[t]:void 0},writable:!0,configurable:!0},getActionIds:{value:function(t){var e=this.getActions(t);if(e)return e.getConstants()},writable:!0,configurable:!0},dispatch:{value:function(t,e){this.dispatcher.dispatch({actionId:t,body:e})},writable:!0,configurable:!0},dispatchAsync:{value:function(t,e,n){var i=this,r={actionId:t,async:"begin"};return n&&(r.actionArgs=n),this.dispatcher.dispatch(r),e.then(function(e){i.dispatcher.dispatch({actionId:t,body:e,async:"success"})},function(e){return i.dispatcher.dispatch({actionId:t,error:e,async:"failure"}),Promise.reject(e)})},writable:!0,configurable:!0},waitFor:{value:function(t){Array.isArray(t)||(t=[t]);var e=function(t){return t instanceof h?t._token:t},n=t.map(e);this.dispatcher.waitFor(n)},writable:!0,configurable:!0},serialize:{value:function n(){var t={};for(var e in this._stores)if(this._stores.hasOwnProperty(e)){var i=this._stores[e],n=i.constructor.serialize;if("function"==typeof n){var r=n(i.state);if("string"!=typeof r){var s=i.constructor.name;console.warn("The store with key '"+e+"' was not serialized because the static "+("method `"+s+".serialize()` returned a non-string with type ")+("'"+typeof r+"'."))}if(t[e]=r,"function"!=typeof i.constructor.deserialize){var s=i.constructor.name;console.warn("The class `"+s+"` has a `serialize()` method, but no corresponding `deserialize()` method.")}}}return JSON.stringify(t)},writable:!0,configurable:!0},deserialize:{value:function r(t){var e=void 0;try{e=JSON.parse(t)}catch(n){var i=this.constructor.name;throw new Error("Invalid value passed to `"+i+"#deserialize()`: "+t)}for(var s in this._stores)if(this._stores.hasOwnProperty(s)){var a=this._stores[s],r=a.constructor.deserialize;if("function"==typeof r){var o=e[s],c=r(o);if(a.replaceState(c),"function"!=typeof a.constructor.serialize){var i=a.constructor.name;console.warn("The class `"+i+"` has a `deserialize()` method, but no corresponding `serialize()` method.")}}}},writable:!0,configurable:!0}}),e}(f);e["default"]=p;var d=p;e.Flux=p,e.Flummox=d,e.Store=h,e.Actions=u,Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,n){"use strict";function i(t){return"function"==typeof t?t._id:t}var r=function(t){return t&&t.__esModule?t["default"]:t},s=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},a=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},c=r(n(4)),h=r(n(6)),u=function(t){function e(){o(this,e),this.state=void 0,this._handlers={},this._asyncHandlers={}}return a(e,t),s(e,null,{getState:{value:function(){return h({},this.state)},writable:!0,configurable:!0},setState:{value:function(t){"undefined"==typeof this.state&&(this.state={}),this._isHandlingDispatch?(this._pendingState=h(this._pendingState,t),this._emitChangeAfterHandlingDispatch=!0):(console.warn("Store#setState() called from outside an action handler. This is likely a mistake. Flux stores should manage their own state."),this.state=h({},this.state,t),this.emit("change"))},writable:!0,configurable:!0},replaceState:{value:function(t){"undefined"==typeof this.state&&(this.state={}),this._isHandlingDispatch?(this._pendingState=h({},t),this._emitChangeAfterHandlingDispatch=!0):(this.state=h({},t),this.emit("change"))},writable:!0,configurable:!0},register:{value:function(t,e){t=i(t),"function"==typeof e&&(this._handlers[t]=e.bind(this))},writable:!0,configurable:!0},registerAsync:{value:function(t,e,n,r){t=i(t);var s={begin:e,success:n,failure:r};for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];"function"==typeof o?s[a]=o.bind(this):delete s[a]}this._asyncHandlers[t]=s},writable:!0,configurable:!0},waitFor:{value:function(t){this._waitFor(t)},writable:!0,configurable:!0},handler:{value:function(t){var e=t.body,n=t.actionId,i=t.async,r=t.actionArgs,s=t.error,a=this._handlers[n],o=this._asyncHandlers[n]&&this._asyncHandlers[n][i];if(i)switch(i){case"begin":return void("function"==typeof o&&this._performHandler.apply(this,[o].concat(r)));case"failure":return void("function"==typeof o&&this._performHandler(o,s));case"success":"function"==typeof o&&(a=o);break;default:return}"function"==typeof a&&this._performHandler(a,e)},writable:!0,configurable:!0},_performHandler:{value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;e>i;i++)n[i-1]=arguments[i];this._isHandlingDispatch=!0,this._pendingState=h({},this.state),this._emitChangeAfterHandlingDispatch=!1;try{t.apply(this,n)}finally{this._emitChangeAfterHandlingDispatch&&(this.state=this._pendingState,this.emit("change")),this._isHandlingDispatch=!1,this._pendingState={},this._emitChangeAfterHandlingDispatch=!1}},writable:!0,configurable:!0}}),e}(c);t.exports=u},function(t,e,n){"use strict";function i(t){return t&&"function"==typeof t.then}var r=function(t){return t&&t.__esModule?t["default"]:t},s=function(t,e,n){e&&Object.defineProperties(t,e),n&&Object.defineProperties(t.prototype,n)},a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=r(n(7)),c=function(){function t(){a(this,t),this._baseId=o();for(var e=this._getActionMethodNames(),n=0;n<e.length;n++){var i=e[n];this._wrapAction(i)}this.getConstants=this.getActionIds}return s(t,null,{getActionIds:{value:function(){var t=this;return this._getActionMethodNames().reduce(function(e,n){return e[n]=t[n]._id,e},{})},writable:!0,configurable:!0},_getActionMethodNames:{value:function(){var t=this;return Object.getOwnPropertyNames(this.constructor.prototype).filter(function(e){return"constructor"!==e&&"function"==typeof t[e]})},writable:!0,configurable:!0},_wrapAction:{value:function(t){var e=this,n=this[t],r=this._createActionId(t),s=function(){for(var s=arguments.length,a=Array(s),o=0;s>o;o++)a[o]=arguments[o];var c=n.apply(e,a);if(i(c)){var h=c;return e._dispatchAsync(r,h,a,t)}return e._dispatch(r,c,a,t)};s._id=r,this[t]=s},writable:!0,configurable:!0},_createActionId:{value:function(t){return""+this._baseId+"-"+t},writable:!0,configurable:!0},_dispatch:{value:function(t,e,n,i){if(!this.dispatch)throw new ReferenceError("You've attempted to perform the action "+(""+this.constructor.name+"#"+i+", but it hasn't been added ")+"to a Flux instance.");"undefined"!=typeof e&&this.dispatch(t,e,n)},writable:!0,configurable:!0},_dispatchAsync:{value:function(t,e,n,i){if(!this.dispatchAsync)throw new ReferenceError("You've attempted to perform the asynchronous action "+(""+this.constructor.name+"#"+i+", but it hasn't been added ")+"to a Flux instance.");return this.dispatchAsync(t,e,n)},writable:!0,configurable:!0}}),t}();t.exports=c},function(t,e,n){t.exports.Dispatcher=n(5)},function(t){"use strict";function e(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function n(){}n.prototype._events=void 0,n.prototype.listeners=function(t){if(!this._events||!this._events[t])return[];if(this._events[t].fn)return[this._events[t].fn];for(var e=0,n=this._events[t].length,i=new Array(n);n>e;e++)i[e]=this._events[t][e].fn;return i},n.prototype.emit=function(t,e,n,i,r,s){if(!this._events||!this._events[t])return!1;var a,o,c=this._events[t],h=arguments.length;if("function"==typeof c.fn){switch(c.once&&this.removeListener(t,c.fn,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,i),!0;case 5:return c.fn.call(c.context,e,n,i,r),!0;case 6:return c.fn.call(c.context,e,n,i,r,s),!0}for(o=1,a=new Array(h-1);h>o;o++)a[o-1]=arguments[o];c.fn.apply(c.context,a)}else{var u,l=c.length;for(o=0;l>o;o++)switch(c[o].once&&this.removeListener(t,c[o].fn,!0),h){case 1:c[o].fn.call(c[o].context);break;case 2:c[o].fn.call(c[o].context,e);break;case 3:c[o].fn.call(c[o].context,e,n);break;default:if(!a)for(u=1,a=new Array(h-1);h>u;u++)a[u-1]=arguments[u];c[o].fn.apply(c[o].context,a)}}return!0},n.prototype.on=function(t,n,i){var r=new e(n,i||this);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],r]:this._events[t].push(r):this._events[t]=r,this},n.prototype.once=function(t,n,i){var r=new e(n,i||this,!0);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],r]:this._events[t].push(r):this._events[t]=r,this},n.prototype.removeListener=function(t,e,n){if(!this._events||!this._events[t])return this;var i=this._events[t],r=[];if(e&&(i.fn&&(i.fn!==e||n&&!i.once)&&r.push(i),!i.fn))for(var s=0,a=i.length;a>s;s++)(i[s].fn!==e||n&&!i[s].once)&&r.push(i[s]);return r.length?this._events[t]=1===r.length?r[0]:r:delete this._events[t],this},n.prototype.removeAllListeners=function(t){return this._events?(t?delete this._events[t]:this._events={},this):this},n.prototype.off=n.prototype.removeListener,n.prototype.addListener=n.prototype.on,n.prototype.setMaxListeners=function(){return this},n.EventEmitter=n,n.EventEmitter2=n,n.EventEmitter3=n,t.exports=n},function(t,e,n){"use strict";function i(){this.$Dispatcher_callbacks={},this.$Dispatcher_isPending={},this.$Dispatcher_isHandled={},this.$Dispatcher_isDispatching=!1,this.$Dispatcher_pendingPayload=null}var r=n(8),s=1,a="ID_";i.prototype.register=function(t){var e=a+s++;return this.$Dispatcher_callbacks[e]=t,e},i.prototype.unregister=function(t){r(this.$Dispatcher_callbacks[t],"Dispatcher.unregister(...): `%s` does not map to a registered callback.",t),delete this.$Dispatcher_callbacks[t]},i.prototype.waitFor=function(t){r(this.$Dispatcher_isDispatching,"Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var e=0;e<t.length;e++){var n=t[e];this.$Dispatcher_isPending[n]?r(this.$Dispatcher_isHandled[n],"Dispatcher.waitFor(...): Circular dependency detected while waiting for `%s`.",n):(r(this.$Dispatcher_callbacks[n],"Dispatcher.waitFor(...): `%s` does not map to a registered callback.",n),this.$Dispatcher_invokeCallback(n))}},i.prototype.dispatch=function(t){r(!this.$Dispatcher_isDispatching,"Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch."),this.$Dispatcher_startDispatching(t);try{for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]||this.$Dispatcher_invokeCallback(e)}finally{this.$Dispatcher_stopDispatching()}},i.prototype.isDispatching=function(){return this.$Dispatcher_isDispatching},i.prototype.$Dispatcher_invokeCallback=function(t){this.$Dispatcher_isPending[t]=!0,this.$Dispatcher_callbacks[t](this.$Dispatcher_pendingPayload),this.$Dispatcher_isHandled[t]=!0},i.prototype.$Dispatcher_startDispatching=function(t){for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]=!1,this.$Dispatcher_isHandled[e]=!1;this.$Dispatcher_pendingPayload=t,this.$Dispatcher_isDispatching=!0},i.prototype.$Dispatcher_stopDispatching=function(){this.$Dispatcher_pendingPayload=null,this.$Dispatcher_isDispatching=!1},t.exports=i},function(t){"use strict";function e(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t){for(var n,i,r=e(t),s=1;s<arguments.length;s++){n=arguments[s],i=Object.keys(Object(n));for(var a=0;a<i.length;a++)r[i[a]]=n[i[a]]}return r}},function(t){"use strict";var e=0,n=t.exports=function(t){t=t||{};var n=t.prefix,i=t.suffix,r=++e*(t.multiplier||1);return null==n&&(n=""),null==i&&(i=""),String(n)+r+String(i)};n.reset=function(){return e=0}},function(t){"use strict";var e=function(t,e,n,i,r,s,a,o){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[n,i,r,s,a,o],u=0;c=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return h[u++]}))}throw c.framesToPop=1,c}};t.exports=e}]); |
@@ -33,2 +33,14 @@ API: `FluxComponent` | ||
Access flux with `this.props.flux` | ||
---------------------------------- | ||
In the child component, you can access the Flux instance with `this.props.flux`. For example, to perform an action: | ||
```js | ||
onClick(e) { | ||
e.preventDefault(); | ||
this.props.flux.getActions('actionsKey').someAction(); | ||
} | ||
``` | ||
Props | ||
@@ -35,0 +47,0 @@ ----- |
@@ -36,3 +36,3 @@ API: `FluxMixin` | ||
// Yet another reason FluxComponent is better :) | ||
posts: function() ( | ||
posts: function(store) ( | ||
return { | ||
@@ -42,3 +42,3 @@ storeA: store.getPost(this.props.post.id), | ||
), | ||
comments: function() ( | ||
comments: function(store) ( | ||
return { | ||
@@ -54,3 +54,3 @@ comments: store.getCommentsForPost(this.props.post.id), | ||
State getters are bound the the component instance, so you can reference props the normal way as `this.props`. When a prop change is detected (by doing a shallow comparison of props in `componentDidUpdate()`), the state from the stores is updated. | ||
State getters are bound to the component instance, so you can reference props the normal way as `this.props`. When a prop change is detected (by doing a shallow comparison of props in `componentDidUpdate()`), the state from the stores is updated. | ||
@@ -61,2 +61,15 @@ The same cannot be said for `this.state` — there's no reliable way to sync store state in response to component state changes without causing an infinite update cycle (at least that I know of). | ||
Access flux with `this.flux` | ||
---------------------------- | ||
You can access the Flux instance with `this.flux`. For example, to perform an action: | ||
```js | ||
onClick(e) { | ||
e.preventDefault(); | ||
this.flux.getActions('actionsKey').someAction(); | ||
} | ||
``` | ||
Methods | ||
@@ -63,0 +76,0 @@ ------- |
@@ -167,3 +167,3 @@ Quick start | ||
return ( | ||
<FluxContainer connectToStores={{ | ||
<FluxComponent connectToStores={{ | ||
messages: store => ({ | ||
@@ -175,3 +175,3 @@ messages: store.messages | ||
<MessageList /> | ||
</FluxContainer> | ||
</FluxComponent> | ||
); | ||
@@ -178,0 +178,0 @@ } |
@@ -54,2 +54,4 @@ /** | ||
var _objectWithoutProperties = function (obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }; | ||
var React = _interopRequire(require("react/addons")); | ||
@@ -71,17 +73,28 @@ | ||
wrapChild: function wrapChild(child) { | ||
var _props = this.props; | ||
var children = _props.children; | ||
var connectToStores = _props.connectToStores; | ||
var props = _objectWithoutProperties(_props, ["children", "connectToStores"]); | ||
return React.addons.cloneWithProps(child, assign({ | ||
flux: this.flux }, this.state, props)); | ||
}, | ||
render: function render() { | ||
var _this = this; | ||
var children = this.props.children; | ||
if (!this.props.children) { | ||
return null; | ||
}var children = React.Children.map(this.props.children, function (child) { | ||
return React.addons.cloneWithProps(child, assign({ | ||
key: child.key || undefined, | ||
flux: _this.flux }, _this.state)); | ||
}); | ||
return React.createElement( | ||
"span", | ||
null, | ||
children | ||
); | ||
}if (React.Children.count(children) === 1) { | ||
var child = children; | ||
return this.wrapChild(child); | ||
} else { | ||
return React.createElement( | ||
"span", | ||
null, | ||
"React.Children.map(children, this.wrapChild)" | ||
); | ||
} | ||
} | ||
@@ -92,2 +105,2 @@ | ||
module.exports = FluxComponent; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hZGRvbnMvRmx1eENvbXBvbmVudC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBaURBLFlBQVksQ0FBQzs7OztJQUVOLEtBQUssMkJBQU0sY0FBYzs7SUFDekIsU0FBUywyQkFBTSxhQUFhOztJQUM1QixNQUFNLDJCQUFNLGVBQWU7O0FBRWxDLElBQUksYUFBYSxHQUFHLEtBQUssQ0FBQyxXQUFXLENBQUM7Ozs7QUFFcEMsUUFBTSxFQUFFLENBQUMsU0FBUyxFQUFFLENBQUM7O0FBRXJCLGlCQUFlLEVBQUEsMkJBQUc7QUFDaEIsV0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsZUFBZSxDQUFDLENBQUM7R0FDekQ7O0F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ox", | ||
"version": "2.8.0", | ||
"version": "2.9.0", | ||
"description": "Idiomatic, modular, testable, isomorphic Flux. No singletons required.", | ||
@@ -28,2 +28,3 @@ "main": "lib/Flux.js", | ||
"babel": "~4.0.1", | ||
"babel-loader": "~4.0.0", | ||
"babel-runtime": "~4.0.1", | ||
@@ -30,0 +31,0 @@ "chai": "~1.10.0", |
@@ -37,5 +37,5 @@ 'use strict'; | ||
loaders: [ | ||
{ test: /\.js$/, loaders: ['6to5-loader?experimental'], exclude: /node_modules/ } | ||
{ test: /\.js$/, loaders: ['babel-loader?experimental'], exclude: /node_modules/ } | ||
] | ||
} | ||
}; |
1376401
3459
13