@onflow/util-actor
Advanced tools
Comparing version 0.0.2 to 1.0.0-alpha.0
@@ -1,3 +0,7 @@ | ||
### Unreleased | ||
## 1.0.0-alpha.0 | ||
### Major Changes | ||
- Release 1.0.0 alpha | ||
- YYYY-MM-DD **BREAKING?** -- description | ||
@@ -4,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
var n,e=(n=require("queue-microtask"))&&"object"==typeof n&&"default"in n?n.default:n;function t(){return(t=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function r(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function o(n,e,t){if(!n.s){if(t instanceof i){if(!t.s)return void(t.o=o.bind(null,n,e));1&e&&(e=t.s),t=t.v}if(t&&t.then)return void t.then(o.bind(null,n,e),o.bind(null,n,2));n.s=e,n.v=t;var r=n.o;r&&r(n)}}var i=function(){function n(){}return n.prototype.then=function(e,t){var r=new n,i=this.s;if(i){var u=1&i?e:t;if(u){try{o(r,1,u(this.v))}catch(n){o(r,2,n)}return r}return this}return this.o=function(n){try{var i=n.v;1&n.s?o(r,1,e?e(i):i):t?o(r,1,t(i)):o(r,2,i)}catch(n){o(r,2,n)}},r},n}();function u(n){return n instanceof i&&1&n.s}function c(n,e,t){for(var r;;){var c=n();if(u(c)&&(c=c.v),!c)return f;if(c.then){r=0;break}var f=t();if(f&&f.then){if(!u(f)){r=1;break}f=f.s}if(e){var s=e();if(s&&s.then&&!u(s)){r=2;break}}}var a=new i,l=o.bind(null,a,2);return(0===r?c.then(h):1===r?f.then(v):s.then(d)).then(void 0,l),a;function v(r){f=r;do{if(e&&(s=e())&&s.then&&!u(s))return void s.then(d).then(void 0,l);if(!(c=n())||u(c)&&!c.v)return void o(a,1,f);if(c.then)return void c.then(h).then(void 0,l);u(f=t())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,l)}function h(n){n?(f=t())&&f.then?f.then(v).then(void 0,l):v(f):o(a,1,f)}function d(){(c=n())?c.then?c.then(h).then(void 0,l):h(c):o(a,1,f)}}var f="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||"object"==typeof window&&window.window===window&&window;f.FCL_REGISTRY=null==f.FCL_REGISTRY?{}:f.FCL_REGISTRY;var s=0,a=function(n,e,t,r){return void 0===r&&(r={}),new Promise(function(o,i){var u=r.expectReply||!1,c=null!=r.timeout?r.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:n,from:r.from,tag:e,data:t,timeout:c,reply:o,reject:i};try{f.FCL_REGISTRY[n].mailbox.deliver(s),u||o(!0)}catch(n){console.error("FCL.Actor -- Could Not Deliver Message",s,n)}})},l=function(n){delete f.FCL_REGISTRY[n]},v=function(n,o){if(void 0===o&&(o=null),null==o&&(o=++s),null!=f.FCL_REGISTRY[o])return o;var i,u;f.FCL_REGISTRY[o]={addr:o,mailbox:(u=[],{deliver:function(n){try{return u.push(n),i&&(i(u.shift()),i=void 0),Promise.resolve()}catch(n){return Promise.reject(n)}},receive:function(){return new Promise(function(n){var e=u.shift();if(e)return n(e);i=n})}}),subs:new Set,kvs:{}};var v,h={self:function(){return o},receive:function(){return f.FCL_REGISTRY[o].mailbox.receive()},send:function(n,e,t,r){return void 0===r&&(r={}),r.from=o,a(n,e,t,r)},sendSelf:function(n,e,t){f.FCL_REGISTRY[o]&&a(o,n,e,t)},broadcast:function(n,e,t){void 0===t&&(t={}),t.from=o;for(var i,u=function(n,e){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=function(n,e){if(n){if("string"==typeof n)return r(n,void 0);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(n,void 0):void 0}}(n))){t&&(n=t);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=n[Symbol.iterator]()).next.bind(t)}(f.FCL_REGISTRY[o].subs);!(i=u()).done;)a(i.value,n,e,t)},subscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.add(n)},unsubscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.delete(n)},subscriberCount:function(){return f.FCL_REGISTRY[o].subs.size},hasSubs:function(){return!!f.FCL_REGISTRY[o].subs.size},put:function(n,e){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=e)},get:function(n,e){var t=f.FCL_REGISTRY[o].kvs[n];return null==t?e:t},delete:function(n){delete f.FCL_REGISTRY[o].kvs[n]},update:function(n,e){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=e(f.FCL_REGISTRY[o].kvs[n]))},keys:function(){return Object.keys(f.FCL_REGISTRY[o].kvs)},all:function(){return f.FCL_REGISTRY[o].kvs},where:function(n){return Object.keys(f.FCL_REGISTRY[o].kvs).reduce(function(e,r){var i;return n.test(r)?t({},e,((i={})[r]=f.FCL_REGISTRY[o].kvs[r],i)):e},{})},merge:function(n){void 0===n&&(n={}),Object.keys(n).forEach(function(e){return f.FCL_REGISTRY[o].kvs[e]=n[e]})}};return"object"==typeof n&&(void 0===(v=n)&&(v={}),n=function(n){try{var e=function(){var e=c(function(){return 1},void 0,function(){return Promise.resolve(n.receive()).then(function(e){var t=function(t,r){try{var o=function(t,r){try{var o=function(){function t(){return Promise.resolve(v[e.tag](n,e,e.data||{})).then(function(){})}var r=function(){if("EXIT"===e.tag){var t=function(){if("function"==typeof v.TERMINATE)return Promise.resolve(v.TERMINATE(n,e,e.data||{})).then(function(){})}();if(t&&t.then)return t.then(function(){})}}();return r&&r.then?r.then(t):t()}()}catch(n){return r(n)}return o&&o.then?o.then(void 0,r):o}(0,function(t){console.error(n.self()+" Error",e,t)})}catch(n){return}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):void 0}(0,function(n,e){});if(t&&t.then)return t.then(function(){})})});return e&&e.then?e.then(function(){}):void 0},t=function(){if("function"==typeof v.INIT)return Promise.resolve(v.INIT(n)).then(function(){})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(n){return Promise.reject(n)}}),e(function(){try{return Promise.resolve(n(h)).then(function(){l(o)})}catch(n){return Promise.reject(n)}}),o};exports.EXIT="EXIT",exports.INIT="INIT",exports.SNAPSHOT="SNAPSHOT",exports.SUBSCRIBE="SUBSCRIBE",exports.TERMINATE="TERMINATE",exports.UNSUBSCRIBE="UNSUBSCRIBE",exports.UPDATED="UPDATED",exports.kill=l,exports.send=a,exports.snapshoter=function(n,e){return e(n),a(n,"SNAPSHOT",null,{expectReply:!0,timeout:0})},exports.spawn=v,exports.subscriber=function(n,e,t){e(n);var r=v(function(e){try{var r;return e.send(n,"SUBSCRIBE"),Promise.resolve(c(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(n,"UNSUBSCRIBE"),void(r=1);t(o.data)})}))}catch(n){return Promise.reject(n)}});return function(){return a(r,"@EXIT")}}; | ||
var n,t=(n=require("queue-microtask"))&&"object"==typeof n&&"default"in n?n.default:n;function e(){return(e=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n}).apply(this,arguments)}function r(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function o(n,t,e){if(!n.s){if(e instanceof i){if(!e.s)return void(e.o=o.bind(null,n,t));1&t&&(t=e.s),e=e.v}if(e&&e.then)return void e.then(o.bind(null,n,t),o.bind(null,n,2));n.s=t,n.v=e;var r=n.o;r&&r(n)}}var i=function(){function n(){}return n.prototype.then=function(t,e){var r=new n,i=this.s;if(i){var u=1&i?t:e;if(u){try{o(r,1,u(this.v))}catch(n){o(r,2,n)}return r}return this}return this.o=function(n){try{var i=n.v;1&n.s?o(r,1,t?t(i):i):e?o(r,1,e(i)):o(r,2,i)}catch(n){o(r,2,n)}},r},n}();function u(n){return n instanceof i&&1&n.s}function c(n,t,e){for(var r;;){var c=n();if(u(c)&&(c=c.v),!c)return f;if(c.then){r=0;break}var f=e();if(f&&f.then){if(!u(f)){r=1;break}f=f.s}if(t){var s=t();if(s&&s.then&&!u(s)){r=2;break}}}var a=new i,l=o.bind(null,a,2);return(0===r?c.then(h):1===r?f.then(v):s.then(d)).then(void 0,l),a;function v(r){f=r;do{if(t&&(s=t())&&s.then&&!u(s))return void s.then(d).then(void 0,l);if(!(c=n())||u(c)&&!c.v)return void o(a,1,f);if(c.then)return void c.then(h).then(void 0,l);u(f=e())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,l)}function h(n){n?(f=e())&&f.then?f.then(v).then(void 0,l):v(f):o(a,1,f)}function d(){(c=n())?c.then?c.then(h).then(void 0,l):h(c):o(a,1,f)}}var f="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||"object"==typeof window&&window.window===window&&window;f.FCL_REGISTRY=null==f.FCL_REGISTRY?{}:f.FCL_REGISTRY;var s=0,a=function(n,t,e,r){return void 0===r&&(r={}),new Promise(function(o,i){var u=r.expectReply||!1,c=null!=r.timeout?r.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:n,from:r.from,tag:t,data:e,timeout:c,reply:o,reject:i};try{f.FCL_REGISTRY[n].mailbox.deliver(s),u||o(!0)}catch(n){console.error("FCL.Actor -- Could Not Deliver Message",s,n)}})},l=function(n){delete f.FCL_REGISTRY[n]},v=function(n,o){if(void 0===o&&(o=null),null==o&&(o=++s),null!=f.FCL_REGISTRY[o])return o;var i,u;f.FCL_REGISTRY[o]={addr:o,mailbox:(u=[],{deliver:function(n){try{return u.push(n),i&&(i(u.shift()),i=void 0),Promise.resolve()}catch(n){return Promise.reject(n)}},receive:function(){return new Promise(function(n){var t=u.shift();if(t)return n(t);i=n})}}),subs:new Set,kvs:{}};var v,h={self:function(){return o},receive:function(){return f.FCL_REGISTRY[o].mailbox.receive()},send:function(n,t,e,r){return void 0===r&&(r={}),r.from=o,a(n,t,e,r)},sendSelf:function(n,t,e){f.FCL_REGISTRY[o]&&a(o,n,t,e)},broadcast:function(n,t,e){void 0===e&&(e={}),e.from=o;for(var i,u=function(n,t){var e="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(e)return(e=e.call(n)).next.bind(e);if(Array.isArray(n)||(e=function(n,t){if(n){if("string"==typeof n)return r(n,void 0);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(n,void 0):void 0}}(n))){e&&(n=e);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(f.FCL_REGISTRY[o].subs);!(i=u()).done;)a(i.value,n,t,e)},subscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.add(n)},unsubscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.delete(n)},subscriberCount:function(){return f.FCL_REGISTRY[o].subs.size},hasSubs:function(){return!!f.FCL_REGISTRY[o].subs.size},put:function(n,t){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=t)},get:function(n,t){var e=f.FCL_REGISTRY[o].kvs[n];return null==e?t:e},delete:function(n){delete f.FCL_REGISTRY[o].kvs[n]},update:function(n,t){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=t(f.FCL_REGISTRY[o].kvs[n]))},keys:function(){return Object.keys(f.FCL_REGISTRY[o].kvs)},all:function(){return f.FCL_REGISTRY[o].kvs},where:function(n){return Object.keys(f.FCL_REGISTRY[o].kvs).reduce(function(t,r){var i;return n.test(r)?e({},t,((i={})[r]=f.FCL_REGISTRY[o].kvs[r],i)):t},{})},merge:function(n){void 0===n&&(n={}),Object.keys(n).forEach(function(t){return f.FCL_REGISTRY[o].kvs[t]=n[t]})}};return"object"==typeof n&&(void 0===(v=n)&&(v={}),n=function(n){try{var t=function(){var t,e=c(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(e){var r=function(r,o){try{var i=function(r,o){try{var i=function(){function r(){return Promise.resolve(v[e.tag](n,e,e.data||{})).then(function(){})}var o=function(){if("EXIT"===e.tag){var r=function(){t=1},o=function(){if("function"==typeof v.TERMINATE)return Promise.resolve(v.TERMINATE(n,e,e.data||{})).then(function(){})}();return o&&o.then?o.then(r):r()}}();return o&&o.then?o.then(r):r()}()}catch(n){return o(n)}return i&&i.then?i.then(void 0,o):i}(0,function(t){console.error(n.self()+" Error",e,t)})}catch(n){return}return i&&i.then?i.then(o.bind(null,!1),o.bind(null,!0)):void 0}(0,function(n,t){});if(r&&r.then)return r.then(function(){})})}),r=function(){if(e&&e.then)return e.then(function(){})}();if(r&&r.then)return r.then(function(){})},e=function(){if("function"==typeof v.INIT)return Promise.resolve(v.INIT(n)).then(function(){})}();return Promise.resolve(e&&e.then?e.then(t):t())}catch(n){return Promise.reject(n)}}),t(function(){try{return Promise.resolve(n(h)).then(function(){l(o)})}catch(n){return Promise.reject(n)}}),o};exports.EXIT="EXIT",exports.INIT="INIT",exports.SNAPSHOT="SNAPSHOT",exports.SUBSCRIBE="SUBSCRIBE",exports.TERMINATE="TERMINATE",exports.UNSUBSCRIBE="UNSUBSCRIBE",exports.UPDATED="UPDATED",exports.kill=l,exports.send=a,exports.snapshoter=function(n,t){return t(n),a(n,"SNAPSHOT",null,{expectReply:!0,timeout:0})},exports.spawn=v,exports.subscriber=function(n,t,e){t(n);var r=v(function(t){try{var r;return t.send(n,"SUBSCRIBE"),Promise.resolve(c(function(){return!r&&1},void 0,function(){return Promise.resolve(t.receive()).then(function(o){if("@EXIT"===o.tag)return t.send(n,"UNSUBSCRIBE"),void(r=1);e(o.data)})}))}catch(n){return Promise.reject(n)}});return function(){return a(r,"@EXIT")}}; | ||
//# sourceMappingURL=actor.js.map |
@@ -1,2 +0,2 @@ | ||
import n from"queue-microtask";function t(){return(t=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n}).apply(this,arguments)}function e(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function r(n,t,e){if(!n.s){if(e instanceof o){if(!e.s)return void(e.o=r.bind(null,n,t));1&t&&(t=e.s),e=e.v}if(e&&e.then)return void e.then(r.bind(null,n,t),r.bind(null,n,2));n.s=t,n.v=e;var i=n.o;i&&i(n)}}var o=function(){function n(){}return n.prototype.then=function(t,e){var o=new n,i=this.s;if(i){var u=1&i?t:e;if(u){try{r(o,1,u(this.v))}catch(n){r(o,2,n)}return o}return this}return this.o=function(n){try{var i=n.v;1&n.s?r(o,1,t?t(i):i):e?r(o,1,e(i)):r(o,2,i)}catch(n){r(o,2,n)}},o},n}();function i(n){return n instanceof o&&1&n.s}function u(n,t,e){for(var u;;){var c=n();if(i(c)&&(c=c.v),!c)return f;if(c.then){u=0;break}var f=e();if(f&&f.then){if(!i(f)){u=1;break}f=f.s}if(t){var s=t();if(s&&s.then&&!i(s)){u=2;break}}}var a=new o,l=r.bind(null,a,2);return(0===u?c.then(h):1===u?f.then(v):s.then(d)).then(void 0,l),a;function v(o){f=o;do{if(t&&(s=t())&&s.then&&!i(s))return void s.then(d).then(void 0,l);if(!(c=n())||i(c)&&!c.v)return void r(a,1,f);if(c.then)return void c.then(h).then(void 0,l);i(f=e())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,l)}function h(n){n?(f=e())&&f.then?f.then(v).then(void 0,l):v(f):r(a,1,f)}function d(){(c=n())?c.then?c.then(h).then(void 0,l):h(c):r(a,1,f)}}var c="INIT",f="SUBSCRIBE",s="UNSUBSCRIBE",a="UPDATED",l="SNAPSHOT",v="EXIT",h="TERMINATE",d="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||"object"==typeof window&&window.window===window&&window;d.FCL_REGISTRY=null==d.FCL_REGISTRY?{}:d.FCL_REGISTRY;var R=0,b=function(n,t,e,r){return void 0===r&&(r={}),new Promise(function(o,i){var u=r.expectReply||!1,c=null!=r.timeout?r.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var f={to:n,from:r.from,tag:t,data:e,timeout:c,reply:o,reject:i};try{d.FCL_REGISTRY[n].mailbox.deliver(f),u||o(!0)}catch(n){console.error("FCL.Actor -- Could Not Deliver Message",f,n)}})},S=function(n){delete d.FCL_REGISTRY[n]},m=function(r,o){if(void 0===o&&(o=null),null==o&&(o=++R),null!=d.FCL_REGISTRY[o])return o;var i,c;d.FCL_REGISTRY[o]={addr:o,mailbox:(c=[],{deliver:function(n){try{return c.push(n),i&&(i(c.shift()),i=void 0),Promise.resolve()}catch(n){return Promise.reject(n)}},receive:function(){return new Promise(function(n){var t=c.shift();if(t)return n(t);i=n})}}),subs:new Set,kvs:{}};var f,s={self:function(){return o},receive:function(){return d.FCL_REGISTRY[o].mailbox.receive()},send:function(n,t,e,r){return void 0===r&&(r={}),r.from=o,b(n,t,e,r)},sendSelf:function(n,t,e){d.FCL_REGISTRY[o]&&b(o,n,t,e)},broadcast:function(n,t,r){void 0===r&&(r={}),r.from=o;for(var i,u=function(n,t){var r;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(r=function(n,t){if(n){if("string"==typeof n)return e(n,void 0);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(n,void 0):void 0}}(n))){r&&(n=r);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=n[Symbol.iterator]()).next.bind(r)}(d.FCL_REGISTRY[o].subs);!(i=u()).done;)b(i.value,n,t,r)},subscribe:function(n){return null!=n&&d.FCL_REGISTRY[o].subs.add(n)},unsubscribe:function(n){return null!=n&&d.FCL_REGISTRY[o].subs.delete(n)},subscriberCount:function(){return d.FCL_REGISTRY[o].subs.size},hasSubs:function(){return!!d.FCL_REGISTRY[o].subs.size},put:function(n,t){null!=n&&(d.FCL_REGISTRY[o].kvs[n]=t)},get:function(n,t){var e=d.FCL_REGISTRY[o].kvs[n];return null==e?t:e},delete:function(n){delete d.FCL_REGISTRY[o].kvs[n]},update:function(n,t){null!=n&&(d.FCL_REGISTRY[o].kvs[n]=t(d.FCL_REGISTRY[o].kvs[n]))},keys:function(){return Object.keys(d.FCL_REGISTRY[o].kvs)},all:function(){return d.FCL_REGISTRY[o].kvs},where:function(n){return Object.keys(d.FCL_REGISTRY[o].kvs).reduce(function(e,r){var i;return n.test(r)?t({},e,((i={})[r]=d.FCL_REGISTRY[o].kvs[r],i)):e},{})},merge:function(n){void 0===n&&(n={}),Object.keys(n).forEach(function(t){return d.FCL_REGISTRY[o].kvs[t]=n[t]})}};return"object"==typeof r&&(void 0===(f=r)&&(f={}),r=function(n){try{var t=function(){var t=u(function(){return 1},void 0,function(){return Promise.resolve(n.receive()).then(function(t){var e=function(e,r){try{var o=function(e,r){try{var o=function(){function e(){return Promise.resolve(f[t.tag](n,t,t.data||{})).then(function(){})}var r=function(){if("EXIT"===t.tag){var e=function(){if("function"==typeof f.TERMINATE)return Promise.resolve(f.TERMINATE(n,t,t.data||{})).then(function(){})}();if(e&&e.then)return e.then(function(){})}}();return r&&r.then?r.then(e):e()}()}catch(n){return r(n)}return o&&o.then?o.then(void 0,r):o}(0,function(e){console.error(n.self()+" Error",t,e)})}catch(n){return}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):void 0}(0,function(n,t){});if(e&&e.then)return e.then(function(){})})});return t&&t.then?t.then(function(){}):void 0},e=function(){if("function"==typeof f.INIT)return Promise.resolve(f.INIT(n)).then(function(){})}();return Promise.resolve(e&&e.then?e.then(t):t())}catch(n){return Promise.reject(n)}}),n(function(){try{return Promise.resolve(r(s)).then(function(){S(o)})}catch(n){return Promise.reject(n)}}),o};function I(n,t,e){t(n);var r=m(function(t){try{var r;return t.send(n,"SUBSCRIBE"),Promise.resolve(u(function(){return!r&&1},void 0,function(){return Promise.resolve(t.receive()).then(function(o){if("@EXIT"===o.tag)return t.send(n,"UNSUBSCRIBE"),void(r=1);e(o.data)})}))}catch(n){return Promise.reject(n)}});return function(){return b(r,"@EXIT")}}function E(n,t){return t(n),b(n,"SNAPSHOT",null,{expectReply:!0,timeout:0})}export{v as EXIT,c as INIT,l as SNAPSHOT,f as SUBSCRIBE,h as TERMINATE,s as UNSUBSCRIBE,a as UPDATED,S as kill,b as send,E as snapshoter,m as spawn,I as subscriber}; | ||
import n from"queue-microtask";function t(){return(t=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n}).apply(this,arguments)}function e(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}function r(n,t,e){if(!n.s){if(e instanceof o){if(!e.s)return void(e.o=r.bind(null,n,t));1&t&&(t=e.s),e=e.v}if(e&&e.then)return void e.then(r.bind(null,n,t),r.bind(null,n,2));n.s=t,n.v=e;var i=n.o;i&&i(n)}}var o=function(){function n(){}return n.prototype.then=function(t,e){var o=new n,i=this.s;if(i){var u=1&i?t:e;if(u){try{r(o,1,u(this.v))}catch(n){r(o,2,n)}return o}return this}return this.o=function(n){try{var i=n.v;1&n.s?r(o,1,t?t(i):i):e?r(o,1,e(i)):r(o,2,i)}catch(n){r(o,2,n)}},o},n}();function i(n){return n instanceof o&&1&n.s}function u(n,t,e){for(var u;;){var c=n();if(i(c)&&(c=c.v),!c)return f;if(c.then){u=0;break}var f=e();if(f&&f.then){if(!i(f)){u=1;break}f=f.s}if(t){var s=t();if(s&&s.then&&!i(s)){u=2;break}}}var a=new o,l=r.bind(null,a,2);return(0===u?c.then(h):1===u?f.then(v):s.then(d)).then(void 0,l),a;function v(o){f=o;do{if(t&&(s=t())&&s.then&&!i(s))return void s.then(d).then(void 0,l);if(!(c=n())||i(c)&&!c.v)return void r(a,1,f);if(c.then)return void c.then(h).then(void 0,l);i(f=e())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,l)}function h(n){n?(f=e())&&f.then?f.then(v).then(void 0,l):v(f):r(a,1,f)}function d(){(c=n())?c.then?c.then(h).then(void 0,l):h(c):r(a,1,f)}}var c="INIT",f="SUBSCRIBE",s="UNSUBSCRIBE",a="UPDATED",l="SNAPSHOT",v="EXIT",h="TERMINATE",d="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||"object"==typeof window&&window.window===window&&window;d.FCL_REGISTRY=null==d.FCL_REGISTRY?{}:d.FCL_REGISTRY;var R=0,b=function(n,t,e,r){return void 0===r&&(r={}),new Promise(function(o,i){var u=r.expectReply||!1,c=null!=r.timeout?r.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var f={to:n,from:r.from,tag:t,data:e,timeout:c,reply:o,reject:i};try{d.FCL_REGISTRY[n].mailbox.deliver(f),u||o(!0)}catch(n){console.error("FCL.Actor -- Could Not Deliver Message",f,n)}})},I=function(n){delete d.FCL_REGISTRY[n]},S=function(r,o){if(void 0===o&&(o=null),null==o&&(o=++R),null!=d.FCL_REGISTRY[o])return o;var i,c;d.FCL_REGISTRY[o]={addr:o,mailbox:(c=[],{deliver:function(n){try{return c.push(n),i&&(i(c.shift()),i=void 0),Promise.resolve()}catch(n){return Promise.reject(n)}},receive:function(){return new Promise(function(n){var t=c.shift();if(t)return n(t);i=n})}}),subs:new Set,kvs:{}};var f,s={self:function(){return o},receive:function(){return d.FCL_REGISTRY[o].mailbox.receive()},send:function(n,t,e,r){return void 0===r&&(r={}),r.from=o,b(n,t,e,r)},sendSelf:function(n,t,e){d.FCL_REGISTRY[o]&&b(o,n,t,e)},broadcast:function(n,t,r){void 0===r&&(r={}),r.from=o;for(var i,u=function(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(r)return(r=r.call(n)).next.bind(r);if(Array.isArray(n)||(r=function(n,t){if(n){if("string"==typeof n)return e(n,void 0);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(n,void 0):void 0}}(n))){r&&(n=r);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(d.FCL_REGISTRY[o].subs);!(i=u()).done;)b(i.value,n,t,r)},subscribe:function(n){return null!=n&&d.FCL_REGISTRY[o].subs.add(n)},unsubscribe:function(n){return null!=n&&d.FCL_REGISTRY[o].subs.delete(n)},subscriberCount:function(){return d.FCL_REGISTRY[o].subs.size},hasSubs:function(){return!!d.FCL_REGISTRY[o].subs.size},put:function(n,t){null!=n&&(d.FCL_REGISTRY[o].kvs[n]=t)},get:function(n,t){var e=d.FCL_REGISTRY[o].kvs[n];return null==e?t:e},delete:function(n){delete d.FCL_REGISTRY[o].kvs[n]},update:function(n,t){null!=n&&(d.FCL_REGISTRY[o].kvs[n]=t(d.FCL_REGISTRY[o].kvs[n]))},keys:function(){return Object.keys(d.FCL_REGISTRY[o].kvs)},all:function(){return d.FCL_REGISTRY[o].kvs},where:function(n){return Object.keys(d.FCL_REGISTRY[o].kvs).reduce(function(e,r){var i;return n.test(r)?t({},e,((i={})[r]=d.FCL_REGISTRY[o].kvs[r],i)):e},{})},merge:function(n){void 0===n&&(n={}),Object.keys(n).forEach(function(t){return d.FCL_REGISTRY[o].kvs[t]=n[t]})}};return"object"==typeof r&&(void 0===(f=r)&&(f={}),r=function(n){try{var t=function(){var t,e=u(function(){return!t&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(e){var r=function(r,o){try{var i=function(r,o){try{var i=function(){function r(){return Promise.resolve(f[e.tag](n,e,e.data||{})).then(function(){})}var o=function(){if("EXIT"===e.tag){var r=function(){t=1},o=function(){if("function"==typeof f.TERMINATE)return Promise.resolve(f.TERMINATE(n,e,e.data||{})).then(function(){})}();return o&&o.then?o.then(r):r()}}();return o&&o.then?o.then(r):r()}()}catch(n){return o(n)}return i&&i.then?i.then(void 0,o):i}(0,function(t){console.error(n.self()+" Error",e,t)})}catch(n){return}return i&&i.then?i.then(o.bind(null,!1),o.bind(null,!0)):void 0}(0,function(n,t){});if(r&&r.then)return r.then(function(){})})}),r=function(){if(e&&e.then)return e.then(function(){})}();if(r&&r.then)return r.then(function(){})},e=function(){if("function"==typeof f.INIT)return Promise.resolve(f.INIT(n)).then(function(){})}();return Promise.resolve(e&&e.then?e.then(t):t())}catch(n){return Promise.reject(n)}}),n(function(){try{return Promise.resolve(r(s)).then(function(){I(o)})}catch(n){return Promise.reject(n)}}),o};function m(n,t,e){t(n);var r=S(function(t){try{var r;return t.send(n,"SUBSCRIBE"),Promise.resolve(u(function(){return!r&&1},void 0,function(){return Promise.resolve(t.receive()).then(function(o){if("@EXIT"===o.tag)return t.send(n,"UNSUBSCRIBE"),void(r=1);e(o.data)})}))}catch(n){return Promise.reject(n)}});return function(){return b(r,"@EXIT")}}function E(n,t){return t(n),b(n,"SNAPSHOT",null,{expectReply:!0,timeout:0})}export{v as EXIT,c as INIT,l as SNAPSHOT,f as SUBSCRIBE,h as TERMINATE,s as UNSUBSCRIBE,a as UPDATED,I as kill,b as send,E as snapshoter,S as spawn,m as subscriber}; | ||
//# sourceMappingURL=actor.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("queue-microtask")):"function"==typeof define&&define.amd?define(["exports","queue-microtask"],e):e((n=n||self).utilActor={},n.queueMicrotask)}(this,function(n,e){function t(){return(t=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function r(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function o(n,e,t){if(!n.s){if(t instanceof i){if(!t.s)return void(t.o=o.bind(null,n,e));1&e&&(e=t.s),t=t.v}if(t&&t.then)return void t.then(o.bind(null,n,e),o.bind(null,n,2));n.s=e,n.v=t;var r=n.o;r&&r(n)}}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var i=function(){function n(){}return n.prototype.then=function(e,t){var r=new n,i=this.s;if(i){var u=1&i?e:t;if(u){try{o(r,1,u(this.v))}catch(n){o(r,2,n)}return r}return this}return this.o=function(n){try{var i=n.v;1&n.s?o(r,1,e?e(i):i):t?o(r,1,t(i)):o(r,2,i)}catch(n){o(r,2,n)}},r},n}();function u(n){return n instanceof i&&1&n.s}function c(n,e,t){for(var r;;){var c=n();if(u(c)&&(c=c.v),!c)return f;if(c.then){r=0;break}var f=t();if(f&&f.then){if(!u(f)){r=1;break}f=f.s}if(e){var s=e();if(s&&s.then&&!u(s)){r=2;break}}}var a=new i,l=o.bind(null,a,2);return(0===r?c.then(d):1===r?f.then(v):s.then(h)).then(void 0,l),a;function v(r){f=r;do{if(e&&(s=e())&&s.then&&!u(s))return void s.then(h).then(void 0,l);if(!(c=n())||u(c)&&!c.v)return void o(a,1,f);if(c.then)return void c.then(d).then(void 0,l);u(f=t())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,l)}function d(n){n?(f=t())&&f.then?f.then(v).then(void 0,l):v(f):o(a,1,f)}function h(){(c=n())?c.then?c.then(d).then(void 0,l):d(c):o(a,1,f)}}var f="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||"object"==typeof window&&window.window===window&&window;f.FCL_REGISTRY=null==f.FCL_REGISTRY?{}:f.FCL_REGISTRY;var s=0,a=function(n,e,t,r){return void 0===r&&(r={}),new Promise(function(o,i){var u=r.expectReply||!1,c=null!=r.timeout?r.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:n,from:r.from,tag:e,data:t,timeout:c,reply:o,reject:i};try{f.FCL_REGISTRY[n].mailbox.deliver(s),u||o(!0)}catch(n){console.error("FCL.Actor -- Could Not Deliver Message",s,n)}})},l=function(n){delete f.FCL_REGISTRY[n]},v=function(n,o){if(void 0===o&&(o=null),null==o&&(o=++s),null!=f.FCL_REGISTRY[o])return o;var i,u;f.FCL_REGISTRY[o]={addr:o,mailbox:(u=[],{deliver:function(n){try{return u.push(n),i&&(i(u.shift()),i=void 0),Promise.resolve()}catch(n){return Promise.reject(n)}},receive:function(){return new Promise(function(n){var e=u.shift();if(e)return n(e);i=n})}}),subs:new Set,kvs:{}};var v,d={self:function(){return o},receive:function(){return f.FCL_REGISTRY[o].mailbox.receive()},send:function(n,e,t,r){return void 0===r&&(r={}),r.from=o,a(n,e,t,r)},sendSelf:function(n,e,t){f.FCL_REGISTRY[o]&&a(o,n,e,t)},broadcast:function(n,e,t){void 0===t&&(t={}),t.from=o;for(var i,u=function(n,e){var t;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(t=function(n,e){if(n){if("string"==typeof n)return r(n,void 0);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(n,void 0):void 0}}(n))){t&&(n=t);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=n[Symbol.iterator]()).next.bind(t)}(f.FCL_REGISTRY[o].subs);!(i=u()).done;)a(i.value,n,e,t)},subscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.add(n)},unsubscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.delete(n)},subscriberCount:function(){return f.FCL_REGISTRY[o].subs.size},hasSubs:function(){return!!f.FCL_REGISTRY[o].subs.size},put:function(n,e){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=e)},get:function(n,e){var t=f.FCL_REGISTRY[o].kvs[n];return null==t?e:t},delete:function(n){delete f.FCL_REGISTRY[o].kvs[n]},update:function(n,e){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=e(f.FCL_REGISTRY[o].kvs[n]))},keys:function(){return Object.keys(f.FCL_REGISTRY[o].kvs)},all:function(){return f.FCL_REGISTRY[o].kvs},where:function(n){return Object.keys(f.FCL_REGISTRY[o].kvs).reduce(function(e,r){var i;return n.test(r)?t({},e,((i={})[r]=f.FCL_REGISTRY[o].kvs[r],i)):e},{})},merge:function(n){void 0===n&&(n={}),Object.keys(n).forEach(function(e){return f.FCL_REGISTRY[o].kvs[e]=n[e]})}};return"object"==typeof n&&(void 0===(v=n)&&(v={}),n=function(n){try{var e=function(){var e=c(function(){return 1},void 0,function(){return Promise.resolve(n.receive()).then(function(e){var t=function(t,r){try{var o=function(t,r){try{var o=function(){function t(){return Promise.resolve(v[e.tag](n,e,e.data||{})).then(function(){})}var r=function(){if("EXIT"===e.tag){var t=function(){if("function"==typeof v.TERMINATE)return Promise.resolve(v.TERMINATE(n,e,e.data||{})).then(function(){})}();if(t&&t.then)return t.then(function(){})}}();return r&&r.then?r.then(t):t()}()}catch(n){return r(n)}return o&&o.then?o.then(void 0,r):o}(0,function(t){console.error(n.self()+" Error",e,t)})}catch(n){return}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):void 0}(0,function(n,e){});if(t&&t.then)return t.then(function(){})})});return e&&e.then?e.then(function(){}):void 0},t=function(){if("function"==typeof v.INIT)return Promise.resolve(v.INIT(n)).then(function(){})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(n){return Promise.reject(n)}}),e(function(){try{return Promise.resolve(n(d)).then(function(){l(o)})}catch(n){return Promise.reject(n)}}),o};n.EXIT="EXIT",n.INIT="INIT",n.SNAPSHOT="SNAPSHOT",n.SUBSCRIBE="SUBSCRIBE",n.TERMINATE="TERMINATE",n.UNSUBSCRIBE="UNSUBSCRIBE",n.UPDATED="UPDATED",n.kill=l,n.send=a,n.snapshoter=function(n,e){return e(n),a(n,"SNAPSHOT",null,{expectReply:!0,timeout:0})},n.spawn=v,n.subscriber=function(n,e,t){e(n);var r=v(function(e){try{var r;return e.send(n,"SUBSCRIBE"),Promise.resolve(c(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(n,"UNSUBSCRIBE"),void(r=1);t(o.data)})}))}catch(n){return Promise.reject(n)}});return function(){return a(r,"@EXIT")}}}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("queue-microtask")):"function"==typeof define&&define.amd?define(["exports","queue-microtask"],e):e((n=n||self).utilActor={},n.queueMicrotask)}(this,function(n,e){function t(){return(t=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n}).apply(this,arguments)}function r(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function o(n,e,t){if(!n.s){if(t instanceof i){if(!t.s)return void(t.o=o.bind(null,n,e));1&e&&(e=t.s),t=t.v}if(t&&t.then)return void t.then(o.bind(null,n,e),o.bind(null,n,2));n.s=e,n.v=t;var r=n.o;r&&r(n)}}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var i=function(){function n(){}return n.prototype.then=function(e,t){var r=new n,i=this.s;if(i){var u=1&i?e:t;if(u){try{o(r,1,u(this.v))}catch(n){o(r,2,n)}return r}return this}return this.o=function(n){try{var i=n.v;1&n.s?o(r,1,e?e(i):i):t?o(r,1,t(i)):o(r,2,i)}catch(n){o(r,2,n)}},r},n}();function u(n){return n instanceof i&&1&n.s}function c(n,e,t){for(var r;;){var c=n();if(u(c)&&(c=c.v),!c)return f;if(c.then){r=0;break}var f=t();if(f&&f.then){if(!u(f)){r=1;break}f=f.s}if(e){var s=e();if(s&&s.then&&!u(s)){r=2;break}}}var a=new i,l=o.bind(null,a,2);return(0===r?c.then(d):1===r?f.then(v):s.then(h)).then(void 0,l),a;function v(r){f=r;do{if(e&&(s=e())&&s.then&&!u(s))return void s.then(h).then(void 0,l);if(!(c=n())||u(c)&&!c.v)return void o(a,1,f);if(c.then)return void c.then(d).then(void 0,l);u(f=t())&&(f=f.v)}while(!f||!f.then);f.then(v).then(void 0,l)}function d(n){n?(f=t())&&f.then?f.then(v).then(void 0,l):v(f):o(a,1,f)}function h(){(c=n())?c.then?c.then(d).then(void 0,l):d(c):o(a,1,f)}}var f="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||"object"==typeof window&&window.window===window&&window;f.FCL_REGISTRY=null==f.FCL_REGISTRY?{}:f.FCL_REGISTRY;var s=0,a=function(n,e,t,r){return void 0===r&&(r={}),new Promise(function(o,i){var u=r.expectReply||!1,c=null!=r.timeout?r.timeout:5e3;u&&c&&setTimeout(function(){return i(new Error("Timeout: "+c+"ms passed without a response."))},c);var s={to:n,from:r.from,tag:e,data:t,timeout:c,reply:o,reject:i};try{f.FCL_REGISTRY[n].mailbox.deliver(s),u||o(!0)}catch(n){console.error("FCL.Actor -- Could Not Deliver Message",s,n)}})},l=function(n){delete f.FCL_REGISTRY[n]},v=function(n,o){if(void 0===o&&(o=null),null==o&&(o=++s),null!=f.FCL_REGISTRY[o])return o;var i,u;f.FCL_REGISTRY[o]={addr:o,mailbox:(u=[],{deliver:function(n){try{return u.push(n),i&&(i(u.shift()),i=void 0),Promise.resolve()}catch(n){return Promise.reject(n)}},receive:function(){return new Promise(function(n){var e=u.shift();if(e)return n(e);i=n})}}),subs:new Set,kvs:{}};var v,d={self:function(){return o},receive:function(){return f.FCL_REGISTRY[o].mailbox.receive()},send:function(n,e,t,r){return void 0===r&&(r={}),r.from=o,a(n,e,t,r)},sendSelf:function(n,e,t){f.FCL_REGISTRY[o]&&a(o,n,e,t)},broadcast:function(n,e,t){void 0===t&&(t={}),t.from=o;for(var i,u=function(n,e){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(t)return(t=t.call(n)).next.bind(t);if(Array.isArray(n)||(t=function(n,e){if(n){if("string"==typeof n)return r(n,void 0);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(n,void 0):void 0}}(n))){t&&(n=t);var o=0;return function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(f.FCL_REGISTRY[o].subs);!(i=u()).done;)a(i.value,n,e,t)},subscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.add(n)},unsubscribe:function(n){return null!=n&&f.FCL_REGISTRY[o].subs.delete(n)},subscriberCount:function(){return f.FCL_REGISTRY[o].subs.size},hasSubs:function(){return!!f.FCL_REGISTRY[o].subs.size},put:function(n,e){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=e)},get:function(n,e){var t=f.FCL_REGISTRY[o].kvs[n];return null==t?e:t},delete:function(n){delete f.FCL_REGISTRY[o].kvs[n]},update:function(n,e){null!=n&&(f.FCL_REGISTRY[o].kvs[n]=e(f.FCL_REGISTRY[o].kvs[n]))},keys:function(){return Object.keys(f.FCL_REGISTRY[o].kvs)},all:function(){return f.FCL_REGISTRY[o].kvs},where:function(n){return Object.keys(f.FCL_REGISTRY[o].kvs).reduce(function(e,r){var i;return n.test(r)?t({},e,((i={})[r]=f.FCL_REGISTRY[o].kvs[r],i)):e},{})},merge:function(n){void 0===n&&(n={}),Object.keys(n).forEach(function(e){return f.FCL_REGISTRY[o].kvs[e]=n[e]})}};return"object"==typeof n&&(void 0===(v=n)&&(v={}),n=function(n){try{var e=function(){var e,t=c(function(){return!e&&1},void 0,function(){return Promise.resolve(n.receive()).then(function(t){var r=function(r,o){try{var i=function(r,o){try{var i=function(){function r(){return Promise.resolve(v[t.tag](n,t,t.data||{})).then(function(){})}var o=function(){if("EXIT"===t.tag){var r=function(){e=1},o=function(){if("function"==typeof v.TERMINATE)return Promise.resolve(v.TERMINATE(n,t,t.data||{})).then(function(){})}();return o&&o.then?o.then(r):r()}}();return o&&o.then?o.then(r):r()}()}catch(n){return o(n)}return i&&i.then?i.then(void 0,o):i}(0,function(e){console.error(n.self()+" Error",t,e)})}catch(n){return}return i&&i.then?i.then(o.bind(null,!1),o.bind(null,!0)):void 0}(0,function(n,e){});if(r&&r.then)return r.then(function(){})})}),r=function(){if(t&&t.then)return t.then(function(){})}();if(r&&r.then)return r.then(function(){})},t=function(){if("function"==typeof v.INIT)return Promise.resolve(v.INIT(n)).then(function(){})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(n){return Promise.reject(n)}}),e(function(){try{return Promise.resolve(n(d)).then(function(){l(o)})}catch(n){return Promise.reject(n)}}),o};n.EXIT="EXIT",n.INIT="INIT",n.SNAPSHOT="SNAPSHOT",n.SUBSCRIBE="SUBSCRIBE",n.TERMINATE="TERMINATE",n.UNSUBSCRIBE="UNSUBSCRIBE",n.UPDATED="UPDATED",n.kill=l,n.send=a,n.snapshoter=function(n,e){return e(n),a(n,"SNAPSHOT",null,{expectReply:!0,timeout:0})},n.spawn=v,n.subscriber=function(n,e,t){e(n);var r=v(function(e){try{var r;return e.send(n,"SUBSCRIBE"),Promise.resolve(c(function(){return!r&&1},void 0,function(){return Promise.resolve(e.receive()).then(function(o){if("@EXIT"===o.tag)return e.send(n,"UNSUBSCRIBE"),void(r=1);t(o.data)})}))}catch(n){return Promise.reject(n)}});return function(){return a(r,"@EXIT")}}}); | ||
//# sourceMappingURL=actor.umd.js.map |
{ | ||
"name": "@onflow/util-actor", | ||
"version": "0.0.2", | ||
"version": "1.0.0-alpha.0", | ||
"description": "A mechanism for forcing order/transitions of scoped async state", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
82305
1