microcosm
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -1,2 +0,2 @@ | ||
module.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5);e.Store=r;var i=n(4);e.Microscope=i;var u=n(3);e.Microcosm=u,e["default"]=u},function(t){"use strict";t.exports=function(t,e){var n=void 0===arguments[0]?{}:arguments[0],r=void 0===arguments[2]?{}:arguments[2],i=Object.keys(n);return i.reduce(function(t,r){return t[r]=e(n[r],r),t},r)}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(1)),u=function(t,e){return""+t+"-"+e};e.identify=u,e["default"]=function(t,e){return i(t,function(t,n){return u(e,n)})}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=r(n(7)),s=r(n(8)),a=r(n(2)),c=r(n(1)),f=n(10).Dispatcher,l=function(){function t(e){u(this,t),this._seed=e||{},this._heart=o(),this._dispatcher=new f,this._dispatcher.register(this._enqueue.bind(this))}return i(t,{listen:{get:function(){return this._heart.listen}},ignore:{get:function(){return this._heart.ignore}},_enqueue:{value:function(t){for(var e in this.stores)this.stores[e].send(t);this._heart.beat()}},addActions:{value:function(t){this.actions=c(t,s(this._dispatcher))}},addStores:{value:function(t){var e=this,n=c(this.actions,a);this.stores=c(t,function(t,r){return new t(n,e._seed[r],e)})}},serialize:{value:function(){return c(this.stores,function(t){return t.serialize()})}}}),t}();t.exports=l},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=r(n(11)),s=o.createClass({displayName:"Microscope",mixins:[o.addons.PureRenderMixin],propTypes:{flux:o.PropTypes.object.isRequired,watch:o.PropTypes.array.isRequired},getDefaultProps:function(){return{element:"div"}},getInitialState:function(){return this.getState()},getState:function(){var t=this.props,e=t.flux,n=t.watch;return n.reduce(function(t,n){return t[n]=e.stores[n].state,t},{})},updateState:function(){this.setState(this.getState())},componentDidMount:function(){this.props.flux.listen(this.updateState)},componentWillUnmount:function(){this.props.flux.ignore(this.updateState)},render:function(){var t=this,e=this.props,n=e.children,r=e.element,s=e.flux,a=i(e,["children","element","flux"]),c=o.Children.map(n,function(e){return o.addons.cloneWithProps(e,u({flux:s},t.state))});return o.createElement(r,a,c)}});t.exports=s},function(t){"use strict";var e=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(e,r){n(this,t),this._tasks=this.register(e),this.state=this.getInitialState(r)}return e(t,{getInitialState:{value:function(){}},register:{value:function(){}},all:{get:function(){return this.state}},send:{value:function(t){var e=t.type,n=t.body;this._tasks&&e in this._tasks&&this._tasks[e].call(this,n)}},toJSON:{value:function(){return this.state}},serialize:{value:function(){return void 0}}}),t}();t.exports=r},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=r(n(9));t.exports=function(t,e,n){return i(n).then(function(n){return t.dispatch({type:e,body:n}),n})}},function(t){"use strict";t.exports=function(){var t=[],e=null,n=function(){for(var e=0;e<t.length;e++)t[e]()};return{ignore:function(e){t=t.filter(function(t){return t!==e})},listen:function(e){t=t.concat(e)},beat:function(){t.length>0&&(cancelAnimationFrame(e),e=requestAnimationFrame(n))}}}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=r(n(6)),u=r(n(1)),o=n(2).identify;t.exports=function(t){return function(e,n){return u(e,function(e,r){var u=o(n,r);return function(){for(var n=arguments.length,r=Array(n),o=0;n>o;o++)r[o]=arguments[o];return i(t,u,e.apply(void 0,r))}},{})}}},function(t){"use strict";t.exports=function(t){return t instanceof Promise?t:Promise.resolve(t)}},function(t){t.exports=require("flux")},function(t){t.exports=require("react/addons")}]); | ||
module.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(5);e.Store=r;var i=n(4);e.Microscope=i;var u=n(3);e.Microcosm=u,e["default"]=u},function(t){"use strict";t.exports=function(t,e){var n=void 0===arguments[0]?{}:arguments[0],r=void 0===arguments[2]?{}:arguments[2],i=Object.keys(n);return i.reduce(function(t,r){return t[r]=e(n[r],r),t},r)}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t};Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(1)),u=function(t,e){return""+t+"-"+e};e.identify=u,e["default"]=function(t,e){return i(t,function(t,n){return u(e,n)})}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=r(n(7)),s=r(n(8)),a=r(n(2)),c=r(n(1)),f=n(10).Dispatcher,l=function(){function t(e){u(this,t),this._seed=e||{},this._heart=o(),this._dispatcher=new f,this._dispatcher.register(this._enqueue.bind(this))}return i(t,{listen:{get:function(){return this._heart.listen}},ignore:{get:function(){return this._heart.ignore}},pump:{get:function(){return this._heart.pump}},_enqueue:{value:function(t){for(var e in this.stores)this.stores[e].send(t);this._heart.pump()}},addActions:{value:function(t){this.actions=c(t,s(this._dispatcher))}},addStores:{value:function(t){var e=this,n=c(this.actions,a);this.stores=c(t,function(t,r){return new t(n,e._seed[r],e)})}},serialize:{value:function(){return c(this.stores,function(t){return t.serialize()})}}}),t}();t.exports=l},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o=r(n(11)),s=o.createClass({displayName:"Microscope",mixins:[o.addons.PureRenderMixin],propTypes:{flux:o.PropTypes.object.isRequired,watch:o.PropTypes.array.isRequired},getDefaultProps:function(){return{element:"div"}},getInitialState:function(){return this.getState()},getState:function(){var t=this.props,e=t.flux,n=t.watch;return n.reduce(function(t,n){return t[n]=e.stores[n].state,t},{})},updateState:function(){this.setState(this.getState())},componentDidMount:function(){this.props.flux.listen(this.updateState)},componentWillUnmount:function(){this.props.flux.ignore(this.updateState)},render:function(){var t=this,e=this.props,n=e.children,r=e.element,s=e.flux,a=i(e,["children","element","flux"]),c=o.Children.map(n,function(e){return o.addons.cloneWithProps(e,u({flux:s},t.state))});return o.createElement(r,a,c)}});t.exports=s},function(t){"use strict";var e=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(e,r){n(this,t),this._tasks=this.register(e),this.state=this.getInitialState(r)}return e(t,{getInitialState:{value:function(){}},register:{value:function(){}},all:{get:function(){return this.state}},send:{value:function(t){var e=t.type,n=t.body;this._tasks&&e in this._tasks&&this._tasks[e].call(this,n)}},toJSON:{value:function(){return this.state}},serialize:{value:function(){return void 0}}}),t}();t.exports=r},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=r(n(9));t.exports=function(t,e,n){return i(n).then(function(n){return t.dispatch({type:e,body:n}),n})}},function(t){"use strict";t.exports=function(){var t=[],e=null,n=function(){for(var e=0;e<t.length;e++)t[e]()};return{ignore:function(e){t=t.filter(function(t){return t!==e})},listen:function(e){t=t.concat(e)},pump:function(){t.length>0&&(cancelAnimationFrame(e),e=requestAnimationFrame(n))}}}},function(t,e,n){"use strict";var r=function(t){return t&&t.__esModule?t["default"]:t},i=r(n(6)),u=r(n(1)),o=n(2).identify;t.exports=function(t){return function(e,n){return u(e,function(e,r){var u=o(n,r);return function(){for(var n=arguments.length,r=Array(n),o=0;n>o;o++)r[o]=arguments[o];return i(t,u,e.apply(void 0,r))}},{})}}},function(t){"use strict";t.exports=function(t){return t instanceof Promise?t:Promise.resolve(t)}},function(t){t.exports=require("flux")},function(t){t.exports=require("react/addons")}]); | ||
//# sourceMappingURL=Microcosm.js.map |
{ | ||
"name": "microcosm", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "An experimental flux implimentation", | ||
@@ -5,0 +5,0 @@ "main": "dist/Microcosm.js", |
@@ -11,3 +11,3 @@ import Heartbeat from '../heartbeat' | ||
heart.beat() | ||
heart.pump() | ||
@@ -21,3 +21,3 @@ spy.should.not.have.been.called | ||
heart.listen(done) | ||
heart.beat() | ||
heart.pump() | ||
}) | ||
@@ -31,3 +31,3 @@ | ||
for (var i = 100; i > 0; i--) { | ||
heart.beat() | ||
heart.pump() | ||
} | ||
@@ -46,3 +46,3 @@ | ||
heart.ignore(stub) | ||
heart.beat() | ||
heart.pump() | ||
@@ -49,0 +49,0 @@ requestAnimationFrame(() => { |
@@ -49,3 +49,3 @@ /** | ||
*/ | ||
beat() { | ||
pump() { | ||
if (_callbacks.length > 0) { | ||
@@ -52,0 +52,0 @@ cancelAnimationFrame(_tick) |
@@ -31,2 +31,6 @@ /** | ||
get pump() { | ||
return this._heart.pump | ||
} | ||
_enqueue(payload) { | ||
@@ -36,3 +40,3 @@ for (let s in this.stores) { | ||
} | ||
this._heart.beat() | ||
this._heart.pump() | ||
} | ||
@@ -39,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
58902
563