microcosm
Advanced tools
Comparing version 12.1.1 to 12.1.2
# Changelog | ||
## 12.1.2 | ||
- Fixed issue where parent repos would send out changes before | ||
children could reconcile. | ||
## 12.1.1 | ||
@@ -4,0 +9,0 @@ |
@@ -293,2 +293,4 @@ 'use strict'; | ||
this.invoke('update'); | ||
this.invoke('release', action); | ||
@@ -1008,2 +1010,7 @@ }, | ||
// Track a dirty flag, this is useful so that we can reconcile | ||
// all Microcosm repos, then release their new state changes | ||
// progressively | ||
this.dirty = false; | ||
// If given state, reset to that snapshot | ||
@@ -1081,8 +1088,12 @@ if (state) { | ||
}, | ||
release: function release(action) { | ||
update: function update$$1() { | ||
var next = this.follower ? this.parent.state : this.recall(this.history.head); | ||
if (next !== this.state) { | ||
this.state = next; | ||
this._emit('change', next); | ||
this.dirty = next !== this.state; | ||
this.state = next; | ||
}, | ||
release: function release(action) { | ||
if (this.dirty) { | ||
this.dirty = false; | ||
this._emit('change', this.state); | ||
} | ||
@@ -1089,0 +1100,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";function t(){this._events=null}function e(t,e){if(null==t)throw new Error("Unable to identify "+t+" action");if(t.done)return t;"string"==typeof t&&(e=t,t=function(t){return t}),k+=1;var n=e||(t.name||A)+"."+k;return t.open=n+".open",t.loading=n+".loading",t.update=t.loading,t.done=n,t.resolve=t.done,t.error=n+".error",t.reject=t.error,t.cancel=n+".cancel",t.cancelled=t.cancel,t.toString=j,t}function n(t,e){return function(n,i){var r=t;if(e)try{r=i.deserialize(t)}catch(t){n.reject(t)}n.resolve(r)}}function i(t){this.ids=0,this.size=0,this.limit=Math.max(1,t||1),this.repos=[],this.genesis=new v(I,"resolve",this),this.append(P,"resolve")}function r(t){return null==t?[]:Array.isArray(t)?t:"string"==typeof t?t.split(D):[t]}function s(t){if(Array.isArray(t))return t.slice(0);if(f(t)===!1)return t;var e={};for(var n in t)e[n]=t[n];return e}function o(){for(var t=null,e=null,n=0,i=arguments.length;n<i;n++){t=t||arguments[n],e=e||t;var r=arguments[n];for(var o in r)t[o]!==r[o]&&(t===e&&(t=s(e)),t[o]=r[o])}return t}function a(t,e){if(null==t)return e;var n=t;for(var i in e)n.hasOwnProperty(i)===!1&&(n===t&&(n=s(t)),n[i]=e[i]);return n}function h(t,e,n){return t.__proto__=e,t.prototype=o(Object.create(e.prototype),{constructor:t},n),t}function u(t,e,n){if(null==t)return n;for(var i=r(e),s=0,o=i.length;s<o;s++){var a=null==t?void 0:t[i[s]];void 0===a&&(s=o,a=n),t=a}return t}function c(t,e,n){var i=r(e),o=i.length;if(o<=0)return n;if(u(t,i)===n)return t;for(var a=s(t),h=a,c=0;c<o;c++){var l=i[c],f=n;c<o-1&&(f=l in h?s(h[l]):{}),h[l]=f,h=h[l]}return a}function l(t){var e=void 0===t?"undefined":R(t);return!!t&&("object"===e||"function"===e)&&"function"==typeof t.then}function f(t){return!!t&&"object"===(void 0===t?"undefined":R(t))}function p(t,e,n){return"function"==typeof t?new t(e,n):Object.create(t)}function d(t,e,n,i){return"function"!=typeof n?c(t,e,n):c(t,e,n(u(t,e,i)))}function v(n,r,s){t.call(this),this.history=s||new i,this.id=this.history.getId(),this.command=e(n),this.timestamp=Date.now(),r&&this.setStatus(r)}function y(t,e){this.repo=e}function g(t,e,n){var i=M[n],r=t[e];return f(r)?r[i]||r[n]:t[e[i]]}function m(t,e){for(var n=e.command,i=e.status,r=[],s=0,o=t.length;s<o;s++){var a=t[s],h=a[0],u=a[1];if(u.register){var c=g(u.register(),n,i);c&&r.push({key:h,domain:u,handler:c})}}return r}function b(t){this.repo=t,this.domains=[],this.registry={},this.meta=this.add(null,y)}function w(){this.pool={}}function _(t,e){return function(n){var i=n.command,r=n.status,s=n.payload,o=g(e.register(),i,r);o&&o.call(e,t,s)}}function x(t,e,n){var i=p(e,n,t);return i.setup&&i.setup(t,n),i.register&&t.on("effect",_(t,i)),i.teardown&&t.on("teardown",i.teardown,i),i}function z(t,e,n){return l(e)?(t.open(),e.then(function(e){return global.setTimeout(function(){return t.resolve(e)},0)},function(e){return global.setTimeout(function(){return t.reject(e)},0)}),t):"function"==typeof e?(e(t,n),t):t.resolve(e)}function S(e,n,r){t.call(this),e=e||{},this.parent=e.parent||null,this.history=this.parent?this.parent.history:new i(e.maxHistory),this.history.addRepo(this),this.realm=new b(this),this.archive=new w,this.initial=this.parent?this.parent.initial:{},this.state=this.parent?this.parent.state:this.initial,this.follower=!!this.parent,this.setup(e),n&&this.reset(n,r)}Object.defineProperty(exports,"__esModule",{value:!0}),t.prototype={on:function(t,e,n,i){return this._events=this._events||[],this._events.push({event:t,fn:e,scope:n,once:i}),this},once:function(t,e,n){return this.on(t,e,n,!0)},off:function(t,e,n){if(null==this._events)return this;for(var i=null==e,r=0;r<this._events.length;){var s=this._events[r];s.event===t&&(i||s.fn===e&&s.scope===n)?this._events.splice(r,1):r+=1}return this},removeAllListeners:function(){this._events=null},_emit:function(t,e){if(null==this._events)return this;for(var n=0;n<this._events.length;){var i=this._events[n];i.event===t&&(i.fn.call(i.scope||this,e),i.once)?this._events.splice(n,1):n+=1}return this}};var k=0,A="_action",j=function(){return this.done},O=e(function(t,e){return n(t,e)},"$reset"),E=e(function(t,e){return n(t,e)},"$patch"),I="$birth",P="$start";i.prototype={getId:function(){return++this.ids},addRepo:function(t){this.repos.push(t)},removeRepo:function(t){var e=this.repos.indexOf(t);~e&&this.repos.splice(e,1)},invoke:function(t,e){for(var n=this.repos,i=0;i<n.length;i++)n[i][t](e)},checkout:function(t){return this.head=t||this.head,this.setActiveBranch(),this.reconcile(this.head),this},append:function(t,e){var n=new v(t,e,this);return n.parent=this.size?this.head:this.genesis,this.size>0?(this.head.first?this.head.next.sibling=n:this.head.first=n,this.head.next=n):this.root=n,this.head=n,this.size+=1,this.head},reconcile:function(t){for(var e=t;e&&(this.invoke("reconcile",e),e!==this.head);)e=e.next;this.archive(),this.invoke("release",t)},archive:function(){for(var t=this.size,e=this.root;t>this.limit&&e.disposable;)t-=1,this.invoke("clean",e.parent),e=e.next;e.prune(),this.root=e,this.size=t},setActiveBranch:function(){for(var t=this.head,e=1;t!==this.root;){var n=t.parent;n.next=t,t=n,e+=1}this.size=e},toggle:function(t){var e=[].concat(t);e.forEach(function(t){return t.toggle("silently")}),this.reconcile(e[0])},map:function(t,e){for(var n=this.size,i=Array(n),r=this.head;n--;)i[n]=t.call(e,r),r=r.parent;return i},toArray:function(){return this.map(function(t){return t})}};var R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D=".",$={};$.inactive={disposable:!1,once:!0,listener:"onStart"},$.open={disposable:!1,once:!0,listener:"onOpen"},$.update={disposable:!1,once:!1,listener:"onUpdate"},$.resolve={disposable:!0,once:!0,listener:"onDone"},$.reject={disposable:!0,once:!0,listener:"onError"},$.cancel={disposable:!0,once:!0,listener:"onCancel"};var M={inactive:"inactive",open:"open",update:"loading",loading:"update",done:"resolve",resolve:"done",reject:"error",error:"reject",cancel:"cancelled",cancelled:"cancel"};h(v,t,{status:"inactive",payload:void 0,disabled:!1,disposable:!1,parent:null,first:null,next:null,sibling:null,is:function(t){return this.command[this.status]===this.command[t]},toggle:function(t){return this.disabled=!this.disabled,t||this.history.reconcile(this),this},then:function(t,e){var n=this;return new Promise(function(t,e){n.onDone(t),n.onError(e)}).then(t,e)},setStatus:function(t){this.status=t,this.disposable=$[t].disposable},prune:function(){this.parent.parent=null}}),Object.keys($).forEach(function(t){var e=$[t],n=e.once,i=e.listener;v.prototype[t]=function(e){return this.disposable||(this.setStatus(t),arguments.length&&(this.payload=e),this.history.reconcile(this),this._emit(t,this.payload)),this},v.prototype[i]=function(e,i){return e&&(n&&this.is(t)?e.call(i,this.payload):this.once(t,e,i)),this}}),Object.defineProperty(v.prototype,"children",{get:function(){for(var t=[],e=this.first;e;)t.unshift(e),e=e.sibling;return t}}),y.prototype={reset:function(t,e){return this.patch(this.repo.getInitialState(),e)},patch:function(t,e){return this.repo.realm.prune(t,e)},register:function(){var t;return t={},t[O]=this.reset,t[E]=this.patch,t}},b.prototype={register:function(t){var e=t.command[t.status];return void 0===this.registry[e]&&(this.registry[e]=m(this.domains,t)),this.registry[e]},add:function(t,e,n){var i=p(e,n,this.repo);return this.domains.push([r(t),i]),this.registry={},i.setup&&i.setup(this.repo,n),i.teardown&&this.repo.on("teardown",i.teardown,i),i},reduce:function(t,e,n){for(var i=e,r=1,s=this.domains.length;r<s;r++){var o=this.domains[r],a=o[0],h=o[1];i=t.call(n,i,a,h)}return i},invoke:function(t,e,n){return this.reduce(function(n,i,r){return r[t]?c(n,i,r[t](u(e,i))):n},n)},prune:function(t,e){return this.reduce(function(t,n){var i=u(e,n);return void 0===i?t:c(t,n,i)},t)}},w.prototype={get:function(t){return this.has(t)?this.pool[t]:null},has:function(t){return this.pool.hasOwnProperty(t)},set:function(t,e){this.pool[t]=e},remove:function(t){delete this.pool[t]}},h(S,t,{setup:function(){},teardown:function(){this._emit("teardown",this),this.history.removeRepo(this),this.removeAllListeners()},getInitialState:function(){return this.initial},recall:function(t){return this.archive.get(t.id)},save:function(t,e){return this.archive.set(t.id,e)},clean:function(t){this.archive.remove(t.id)},dispatch:function(t,e){for(var n=this.realm.register(e),i=t,r=0,s=n.length;r<s;r++){var o=n[r],a=o.key,h=o.domain,l=o.handler,f=u(t,a);i=c(i,a,l.call(h,f,e.payload))}return i},reconcile:function(t){if(this.follower)return this;var e=a(this.recall(t.parent),this.initial);return this.parent&&(e=o(e,this.parent.recall(t))),t.disabled||(e=this.dispatch(e,t)),this.save(t,e),this},release:function(t){var e=this.follower?this.parent.state:this.recall(this.history.head);e!==this.state&&(this.state=e,this._emit("change",e)),this._emit("effect",t)},append:function(t,e){return this.history.append(t,e)},push:function(t){for(var e=this.append(t),n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return z(e,e.command.apply(null,i),this),e},prepare:function(){for(var t=this,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.push.apply(t,n.concat(i))}},addDomain:function(t,e,n){var i=this.realm.add(t,e,n);return this.follower=!1,i.getInitialState&&(this.initial=c(this.initial,t,i.getInitialState())),this.history.checkout(),i},addEffect:function(t,e){return x(this,t,e)},reset:function(t,e){return this.push(O,t,e)},patch:function(t,e){return this.push(E,t,e)},deserialize:function(t){var e=t;return this.parent?e=this.parent.deserialize(t):"string"==typeof e&&(e=JSON.parse(e)),this.realm.invoke("deserialize",e,e)},serialize:function(){var t=this.parent?this.parent.serialize():{};return this.realm.invoke("serialize",this.state,t)},toJSON:function(){return this.serialize()},checkout:function(t){return this.history.checkout(t),this},fork:function(){return new S({parent:this})}}),exports.default=S,exports.Microcosm=S,exports.Action=v,exports.History=i,exports.tag=e,exports.get=u,exports.set=c,exports.update=d,exports.merge=o,exports.inherit=h,exports.getRegistration=g; | ||
"use strict";function t(){this._events=null}function e(t,e){if(null==t)throw new Error("Unable to identify "+t+" action");if(t.done)return t;"string"==typeof t&&(e=t,t=function(t){return t}),S+=1;var n=e||(t.name||A)+"."+S;return t.open=n+".open",t.loading=n+".loading",t.update=t.loading,t.done=n,t.resolve=t.done,t.error=n+".error",t.reject=t.error,t.cancel=n+".cancel",t.cancelled=t.cancel,t.toString=j,t}function n(t,e){return function(n,i){var r=t;if(e)try{r=i.deserialize(t)}catch(t){n.reject(t)}n.resolve(r)}}function i(t){this.ids=0,this.size=0,this.limit=Math.max(1,t||1),this.repos=[],this.genesis=new v(I,"resolve",this),this.append(P,"resolve")}function r(t){return null==t?[]:Array.isArray(t)?t:"string"==typeof t?t.split(D):[t]}function s(t){if(Array.isArray(t))return t.slice(0);if(f(t)===!1)return t;var e={};for(var n in t)e[n]=t[n];return e}function o(){for(var t=null,e=null,n=0,i=arguments.length;n<i;n++){t=t||arguments[n],e=e||t;var r=arguments[n];for(var o in r)t[o]!==r[o]&&(t===e&&(t=s(e)),t[o]=r[o])}return t}function a(t,e){if(null==t)return e;var n=t;for(var i in e)n.hasOwnProperty(i)===!1&&(n===t&&(n=s(t)),n[i]=e[i]);return n}function h(t,e,n){return t.__proto__=e,t.prototype=o(Object.create(e.prototype),{constructor:t},n),t}function u(t,e,n){if(null==t)return n;for(var i=r(e),s=0,o=i.length;s<o;s++){var a=null==t?void 0:t[i[s]];void 0===a&&(s=o,a=n),t=a}return t}function c(t,e,n){var i=r(e),o=i.length;if(o<=0)return n;if(u(t,i)===n)return t;for(var a=s(t),h=a,c=0;c<o;c++){var l=i[c],f=n;c<o-1&&(f=l in h?s(h[l]):{}),h[l]=f,h=h[l]}return a}function l(t){var e=void 0===t?"undefined":R(t);return!!t&&("object"===e||"function"===e)&&"function"==typeof t.then}function f(t){return!!t&&"object"===(void 0===t?"undefined":R(t))}function p(t,e,n){return"function"==typeof t?new t(e,n):Object.create(t)}function d(t,e,n,i){return"function"!=typeof n?c(t,e,n):c(t,e,n(u(t,e,i)))}function v(n,r,s){t.call(this),this.history=s||new i,this.id=this.history.getId(),this.command=e(n),this.timestamp=Date.now(),r&&this.setStatus(r)}function y(t,e){this.repo=e}function g(t,e,n){var i=M[n],r=t[e];return f(r)?r[i]||r[n]:t[e[i]]}function m(t,e){for(var n=e.command,i=e.status,r=[],s=0,o=t.length;s<o;s++){var a=t[s],h=a[0],u=a[1];if(u.register){var c=g(u.register(),n,i);c&&r.push({key:h,domain:u,handler:c})}}return r}function b(t){this.repo=t,this.domains=[],this.registry={},this.meta=this.add(null,y)}function w(){this.pool={}}function _(t,e){return function(n){var i=n.command,r=n.status,s=n.payload,o=g(e.register(),i,r);o&&o.call(e,t,s)}}function x(t,e,n){var i=p(e,n,t);return i.setup&&i.setup(t,n),i.register&&t.on("effect",_(t,i)),i.teardown&&t.on("teardown",i.teardown,i),i}function k(t,e,n){return l(e)?(t.open(),e.then(function(e){return global.setTimeout(function(){return t.resolve(e)},0)},function(e){return global.setTimeout(function(){return t.reject(e)},0)}),t):"function"==typeof e?(e(t,n),t):t.resolve(e)}function z(e,n,r){t.call(this),e=e||{},this.parent=e.parent||null,this.history=this.parent?this.parent.history:new i(e.maxHistory),this.history.addRepo(this),this.realm=new b(this),this.archive=new w,this.initial=this.parent?this.parent.initial:{},this.state=this.parent?this.parent.state:this.initial,this.follower=!!this.parent,this.setup(e),this.dirty=!1,n&&this.reset(n,r)}Object.defineProperty(exports,"__esModule",{value:!0}),t.prototype={on:function(t,e,n,i){return this._events=this._events||[],this._events.push({event:t,fn:e,scope:n,once:i}),this},once:function(t,e,n){return this.on(t,e,n,!0)},off:function(t,e,n){if(null==this._events)return this;for(var i=null==e,r=0;r<this._events.length;){var s=this._events[r];s.event===t&&(i||s.fn===e&&s.scope===n)?this._events.splice(r,1):r+=1}return this},removeAllListeners:function(){this._events=null},_emit:function(t,e){if(null==this._events)return this;for(var n=0;n<this._events.length;){var i=this._events[n];i.event===t&&(i.fn.call(i.scope||this,e),i.once)?this._events.splice(n,1):n+=1}return this}};var S=0,A="_action",j=function(){return this.done},O=e(function(t,e){return n(t,e)},"$reset"),E=e(function(t,e){return n(t,e)},"$patch"),I="$birth",P="$start";i.prototype={getId:function(){return++this.ids},addRepo:function(t){this.repos.push(t)},removeRepo:function(t){var e=this.repos.indexOf(t);~e&&this.repos.splice(e,1)},invoke:function(t,e){for(var n=this.repos,i=0;i<n.length;i++)n[i][t](e)},checkout:function(t){return this.head=t||this.head,this.setActiveBranch(),this.reconcile(this.head),this},append:function(t,e){var n=new v(t,e,this);return n.parent=this.size?this.head:this.genesis,this.size>0?(this.head.first?this.head.next.sibling=n:this.head.first=n,this.head.next=n):this.root=n,this.head=n,this.size+=1,this.head},reconcile:function(t){for(var e=t;e&&(this.invoke("reconcile",e),e!==this.head);)e=e.next;this.archive(),this.invoke("update"),this.invoke("release",t)},archive:function(){for(var t=this.size,e=this.root;t>this.limit&&e.disposable;)t-=1,this.invoke("clean",e.parent),e=e.next;e.prune(),this.root=e,this.size=t},setActiveBranch:function(){for(var t=this.head,e=1;t!==this.root;){var n=t.parent;n.next=t,t=n,e+=1}this.size=e},toggle:function(t){var e=[].concat(t);e.forEach(function(t){return t.toggle("silently")}),this.reconcile(e[0])},map:function(t,e){for(var n=this.size,i=Array(n),r=this.head;n--;)i[n]=t.call(e,r),r=r.parent;return i},toArray:function(){return this.map(function(t){return t})}};var R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D=".",$={};$.inactive={disposable:!1,once:!0,listener:"onStart"},$.open={disposable:!1,once:!0,listener:"onOpen"},$.update={disposable:!1,once:!1,listener:"onUpdate"},$.resolve={disposable:!0,once:!0,listener:"onDone"},$.reject={disposable:!0,once:!0,listener:"onError"},$.cancel={disposable:!0,once:!0,listener:"onCancel"};var M={inactive:"inactive",open:"open",update:"loading",loading:"update",done:"resolve",resolve:"done",reject:"error",error:"reject",cancel:"cancelled",cancelled:"cancel"};h(v,t,{status:"inactive",payload:void 0,disabled:!1,disposable:!1,parent:null,first:null,next:null,sibling:null,is:function(t){return this.command[this.status]===this.command[t]},toggle:function(t){return this.disabled=!this.disabled,t||this.history.reconcile(this),this},then:function(t,e){var n=this;return new Promise(function(t,e){n.onDone(t),n.onError(e)}).then(t,e)},setStatus:function(t){this.status=t,this.disposable=$[t].disposable},prune:function(){this.parent.parent=null}}),Object.keys($).forEach(function(t){var e=$[t],n=e.once,i=e.listener;v.prototype[t]=function(e){return this.disposable||(this.setStatus(t),arguments.length&&(this.payload=e),this.history.reconcile(this),this._emit(t,this.payload)),this},v.prototype[i]=function(e,i){return e&&(n&&this.is(t)?e.call(i,this.payload):this.once(t,e,i)),this}}),Object.defineProperty(v.prototype,"children",{get:function(){for(var t=[],e=this.first;e;)t.unshift(e),e=e.sibling;return t}}),y.prototype={reset:function(t,e){return this.patch(this.repo.getInitialState(),e)},patch:function(t,e){return this.repo.realm.prune(t,e)},register:function(){var t;return t={},t[O]=this.reset,t[E]=this.patch,t}},b.prototype={register:function(t){var e=t.command[t.status];return void 0===this.registry[e]&&(this.registry[e]=m(this.domains,t)),this.registry[e]},add:function(t,e,n){var i=p(e,n,this.repo);return this.domains.push([r(t),i]),this.registry={},i.setup&&i.setup(this.repo,n),i.teardown&&this.repo.on("teardown",i.teardown,i),i},reduce:function(t,e,n){for(var i=e,r=1,s=this.domains.length;r<s;r++){var o=this.domains[r],a=o[0],h=o[1];i=t.call(n,i,a,h)}return i},invoke:function(t,e,n){return this.reduce(function(n,i,r){return r[t]?c(n,i,r[t](u(e,i))):n},n)},prune:function(t,e){return this.reduce(function(t,n){var i=u(e,n);return void 0===i?t:c(t,n,i)},t)}},w.prototype={get:function(t){return this.has(t)?this.pool[t]:null},has:function(t){return this.pool.hasOwnProperty(t)},set:function(t,e){this.pool[t]=e},remove:function(t){delete this.pool[t]}},h(z,t,{setup:function(){},teardown:function(){this._emit("teardown",this),this.history.removeRepo(this),this.removeAllListeners()},getInitialState:function(){return this.initial},recall:function(t){return this.archive.get(t.id)},save:function(t,e){return this.archive.set(t.id,e)},clean:function(t){this.archive.remove(t.id)},dispatch:function(t,e){for(var n=this.realm.register(e),i=t,r=0,s=n.length;r<s;r++){var o=n[r],a=o.key,h=o.domain,l=o.handler,f=u(t,a);i=c(i,a,l.call(h,f,e.payload))}return i},reconcile:function(t){if(this.follower)return this;var e=a(this.recall(t.parent),this.initial);return this.parent&&(e=o(e,this.parent.recall(t))),t.disabled||(e=this.dispatch(e,t)),this.save(t,e),this},update:function(){var t=this.follower?this.parent.state:this.recall(this.history.head);this.dirty=t!==this.state,this.state=t},release:function(t){this.dirty&&(this.dirty=!1,this._emit("change",this.state)),this._emit("effect",t)},append:function(t,e){return this.history.append(t,e)},push:function(t){for(var e=this.append(t),n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return k(e,e.command.apply(null,i),this),e},prepare:function(){for(var t=this,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.push.apply(t,n.concat(i))}},addDomain:function(t,e,n){var i=this.realm.add(t,e,n);return this.follower=!1,i.getInitialState&&(this.initial=c(this.initial,t,i.getInitialState())),this.history.checkout(),i},addEffect:function(t,e){return x(this,t,e)},reset:function(t,e){return this.push(O,t,e)},patch:function(t,e){return this.push(E,t,e)},deserialize:function(t){var e=t;return this.parent?e=this.parent.deserialize(t):"string"==typeof e&&(e=JSON.parse(e)),this.realm.invoke("deserialize",e,e)},serialize:function(){var t=this.parent?this.parent.serialize():{};return this.realm.invoke("serialize",this.state,t)},toJSON:function(){return this.serialize()},checkout:function(t){return this.history.checkout(t),this},fork:function(){return new z({parent:this})}}),exports.default=z,exports.Microcosm=z,exports.Action=v,exports.History=i,exports.tag=e,exports.get=u,exports.set=c,exports.update=d,exports.merge=o,exports.inherit=h,exports.getRegistration=g; |
{ | ||
"name": "microcosm", | ||
"version": "12.1.1", | ||
"version": "12.1.2", | ||
"description": "Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.", | ||
@@ -5,0 +5,0 @@ "main": "microcosm.js", |
198388
1392