rxact
Version:
an observable application management for Javascript apps
1 lines • 8.75 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.rxcat=t():e.rxcat=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default=function(e){return!!e&&(!!e[o.default]||!(!e.prototype||!e.prototype[o.default]))}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}return Array.from(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(2),s=r(10),f=n(s),c=r(11),l=n(c),b=r(12),d=n(b),p=function(){function e(t,r,n){var o=this;if(u(this,e),this.emitters={},this.subscriptions=[],this.observers=[],this.dispose=function(){o.subscriptions.forEach(function(e){e.unsubscribe()})},this.installPlugins=function(){var t=o;return e.plugins.forEach(function(e){if("function"!=typeof e)throw Error("Expected plugin to be a function.");var r=e(t);r&&(t=r)}),t},"string"!=typeof t||!t)throw Error("Expected the streamName to be a not none string.");return this.streamName=t,this.Observable=(0,a.getObservable)(),this.state$=f.default.call(this,r),this.state$=l.default.call(this,this.state$,t,n),this.eventRunner=(0,d.default)(this.Observable,this.getState),this.installPlugins()}return i(e,[{key:"emitter",value:function(e,t){var r=this;if(!e)throw Error("emitter(): name should not be blank.");if("function"!=typeof t)throw Error("emitter(): expect second parameter to be a function.");this[e]=function(){r.next(t.apply(void 0,arguments))},this.emitters[e]=this[e]}}]),e}();p.plugins=[],p.addPlugin=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];t.forEach(function(e){if("function"!=typeof e)throw Error("Expected plugin to be a function.")}),p.plugins=[].concat(o(p.plugins),t)},p.removePlugin=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=[];0!==t.length&&(n=p.plugins.filter(function(e){return!t.find(function(t){return t===e})})),p.plugins=n},t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cleanObservable=t.getObservable=t.setObservable=void 0;var n=r(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n),u=null;t.setObservable=function(e){if((0,o.default)(u))throw Error("Expected setup once in your app lifetime.");u=e},t.getObservable=function(){if(!u)throw Error("You must configure Observable first.");return u},t.cleanObservable=function(){u=null}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.isObservable=t.getObservable=t.teardown=t.setup=t.StateStream=void 0;var o=r(1),u=n(o),i=r(13),a=r(2),s=r(0),f=n(s);t.StateStream=u.default,t.setup=i.setup,t.teardown=i.teardown,t.getObservable=a.getObservable,t.isObservable=f.default},function(e,t,r){r(3),e.exports=r(3)},function(e,t,r){e.exports=r(6)},function(e,t,r){"use strict";(function(e,n){Object.defineProperty(t,"__esModule",{value:!0});var o,u=r(9),i=function(e){return e&&e.__esModule?e:{default:e}}(u);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var a=(0,i.default)(o);t.default=a}).call(t,r(7),r(8)(e))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";function n(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e){var t=this,r=!1,n=e;this.observers=[],this.getState=function(){return n},this.next=function(e){if(!r){if("function"!=typeof e)throw Error("Expected passing a function to emitState.");var o=e(n);n=o,t.observers.forEach(function(e){e.next(o)})}};var u=new this.Observable(function(e){return t.observers.push(e),e.next(n),{unsubscribe:function(){t.observers=t.observers.filter(function(t){return t!==e})}}});return this.subscriptions.push({unsubscribe:function(){r=!0,t.next=o,t.observers.forEach(function(e){e.complete()}),t.observers=[]}}),u}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){console.warn("You are calling function on a disposed StateStream.")};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t,r){var n=this;if(!r||0===r.length)return e;var i={},s=[].concat(u(r),[{streamName:t,state$:e}]);if(s.forEach(function(e){if(!(e instanceof f.default||(0,l.default)(e.state$)&&e.streamName))throw Error("Expected the element of stateStreams to be instance of StateStream.");i[e.streamName]=!0}),Object.keys(i).length!==s.length)throw Error("StateStreams' name should be unique.");return new this.Observable(function(e){var t={},r=s.map(function(r){return r.state$.subscribe(function(n){var u=r.streamName,i=a({},t,o({},u,n));t=i,Object.keys(t).length===s.length&&e.next(t)})});return n.subscriptions=n.subscriptions.concat(r),{unsubscribe:function(){r.forEach(function(e){e.unsubscribe()})}}})}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(1),f=n(s),c=r(0),l=n(c);t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=function(e){return e&&e.__esModule?e:{default:e}}(n),u=function(e){return e},i=function(e,t,r){return void 0===e?t.of(r()):(0,o.default)(e)?e:t.of(e)};t.default=function(e,t){return function(r,n){var a=i(n,e,t);if(null!==r&&void 0!==r||(r=u),"function"!=typeof r)throw Error("Expected first parameter of eventRunner to be a function.");var s=r(a);if(!s||!(0,o.default)(s))throw Error("Expected an Observable object returned by factory in eventRunner");var f=void 0,c=void 0,l=void 0,b=new e(function(e){return void 0!==f&&e.next(f),c=function(t){return e.next(t)},{unsubscribe:function(){l.unsubscribe()}}});return l=s.subscribe(function(e){"function"==typeof c&&c(e),f=e}),b}}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.teardown=t.setup=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(1),a=n(i),s=r(2),f=r(0),c=n(f),l=a.default;t.setup=function(e){var t;if("object"!==(void 0===e?"undefined":u(e)))throw Error("setup(): Expected options to be an object.");var r=e.Observable,n=e.plugins,i=void 0===n?[]:n,f=e.HOStateStream,b=void 0===f?a.default:f;if(!(0,c.default)(r))throw Error("setup(): Expected an ES Observable. For more info: https://github.com/tc39/proposal-observable");if((0,s.setObservable)(r),!Array.isArray(i))throw Error("setup(): Expected plugins to be an array");l=b,(t=l).addPlugin.apply(t,o(i))},t.teardown=function(){(0,s.cleanObservable)(),l.removePlugin()}}])});