Comparing version 2.0.7 to 2.0.8
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.immview=e():t.immview=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";var n=r(1);e.Dispatcher=n.Dispatcher;var i=r(2),o=r(3);e.Observable=o.Observable;var s=r(8);e.Merge=s.Merge;var u=r(7);e.Domain=u.Domain;var c=r(6);e.action=c.action;var a=function(t){n.Dispatcher.push(t,i.DispatcherPriorities.EXTERNAL)};e.dispatch=a},function(t,e,r){"use strict";var n=r(5),i=new n.Dispatcher;e.Dispatcher=i;var o=function(t,e){i.push(t,e),i.run()};e.dispatch=o;var s=function(t,e){return new Promise(function(r,n){o(function(){try{r(t())}catch(t){console.error(t.stack||t.message||t),n(t)}},e)})};e.dispatchPromise=s},function(t,e){"use strict";var r;!function(t){t[t.OBSERVABLE=1]="OBSERVABLE",t[t.DOMAIN=2]="DOMAIN",t[t.BUFFER=3]="BUFFER",t[t.EXTERNAL=4]="EXTERNAL",t[t.TEST=10]="TEST"}(r=e.DispatcherPriorities||(e.DispatcherPriorities={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(4),o=r(2),s=r(1),u="undefined"!=typeof Symbol?Symbol("ObservableSymbol"):"ObservableSymbol",c=function(t){function e(){return t.apply(this,arguments)||this}return n(e,t),e.of=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return e.from(t)},e.from=function(t){if(t[u])return new e(function(e){t[u]().subscribe(e.next,e.error,e.complete)});if(t[Symbol.iterator])return new e(function(e){for(var r=e.next,n=e.error,i=e.complete,o=t[Symbol.iterator](),s=o.next();s.done===!1;s=o.next())s.value instanceof Error?n(s.value):r(s.value);i()});throw Error("Observable.from incorrect input")},e.prototype.map=function(t){var r=this;return new e(function(e){var n=r.subscribe(function(r){try{e.next(t(r))}catch(t){e.error(t)}},e.error,e.complete);return function(){return n.unsubscribe()}})},e.prototype.flatten=function(){var t=this;return new e(function(e){t.subscribe(function(t){t&&t.subscribe(function(t){e.next(t)},function(t){return e.error(t)})},e.error,e.complete)})},e.prototype.scan=function(t){var r=this;return new e(function(e){var n,i=0,o=r.subscribe(function(r){try{n=t(n,r,i++),e.next(n)}catch(t){e.error(t)}},e.error,e.complete);return function(){return o.unsubscribe()}})},e.prototype.filter=function(t){var r=this;return new e(function(e){var n=r.subscribe(function(r){try{t(r)&&e.next(r)}catch(t){e.error(t)}},e.error,e.complete);return function(){return n.unsubscribe()}})},e.prototype.bufferCount=function(t,r){var n=this;void 0===r&&(r=null);var i=r||t,o=[];return new e(function(e){var r=n.subscribe(function(r){o.push(r),o.length===t&&(e.next(o.slice()),o=o.splice(i,t-i))},e.error,function(){o.length>t-i&&e.next(o.slice()),e.complete()});return function(){return r.unsubscribe()}})},e.prototype.buffer=function(t){var r=this;void 0===t&&(t=0);var n=[];return new e(function(e){var i=r.subscribe(function(r){n=t>0?[r].concat(n).splice(0,t):[r].concat(n),s.Dispatcher.push(function(){0!==n.length&&e.next(n.splice(0).reverse())},o.DispatcherPriorities.BUFFER).run()},e.error,function(){n.length>0&&e.next(n.splice(0).reverse()),e.complete()});return function(){return i.unsubscribe()}})},e}(i.BaseObservable);e.Observable=c,c.prototype[u]=function(){return this}},function(t,e,r){"use strict";var n,i=r(1),o=r(2),s=r(9);!function(t){t[t.Next=0]="Next",t[t.Error=1]="Error",t[t.Complete=2]="Complete"}(n=e.MessageTypes||(e.MessageTypes={}));var u=function(){},c=function(){function t(e){var r=this;this.closed=!1;var i=this;return this.observers=[],this.priority=t.lastObservablePriority++,e?void(this.cancelSubscriber=e({next:function(t){r.pushMessage([n.Next,"function"==typeof t?t:function(){return t},u])},error:function(t){r.pushMessage([n.Error,t,u])},complete:function(){r.pushMessage([n.Complete,,u])},get closed(){return i.observers.length>0}})||u):void(this.cancelSubscriber=u)}return t.prototype.previous=function(){return this.lastValue},t.prototype.start=function(){},t.prototype.next=function(t){this.pushMessage([n.Next,"function"==typeof t?t:function(){return t},u])},t.prototype.error=function(t){this.pushMessage([n.Error,t,u])},t.prototype.complete=function(){this.pushMessage([n.Complete,,u])},t.prototype.subscribe=function(){for(var e=this,r=[],n=0;arguments.length>n;n++)r[n]=arguments[n];if(this.closed)return new s.Subscription(null,function(){return!1});if("object"!=typeof r[0]||null===r[0]){var i=r[0],o=void 0===i?u:i,c=r[1],a=void 0===c?u:c,f=r[2],p=void 0===f?u:f;return this.subscribe({start:u,next:o,error:a,complete:p})}var l=r[0];this.observers.push(l);var h=new s.Subscription(function(){e.observers=e.observers.filter(function(t){return t!==l})},function(){return e.observers.indexOf(l)>-1});return l.start(h),t.dispatchDigestMessages(),h},t.prototype.pushMessage=function(e){this.closed||(t.awaitingMessages.push([this,e]),t.dispatchDigestMessages())},t.dispatchDigestMessages=function(){i.dispatch(t.digestAwaitingMessages,o.DispatcherPriorities.OBSERVABLE)},t.digestAwaitingMessages=function(){var e=t.popMessage(),r=e[0],n=e[1];r&&!r.closed&&(t.digestNodeMessage(r,n),t.dispatchDigestMessages())},t.popMessage=function(){if(0===t.awaitingMessages.length)return[null,null];for(var e=0;t.awaitingMessages.length>e;e++){var r=t.awaitingMessages[e],n=r[0],i=void 0===n?null:n,o=r[1];if(i.observers.length)return t.awaitingMessages.splice(e,1),[i,o]}return[null,null]},t.digestNodeMessage=function(t,e){var r=e[0],s=e[2];if(r===n.Next){var c=e,a=c[1],f=a(t.lastValue);t.lastValue=f,t.observers.forEach(function(t){return t.next(f)})}else if(r===n.Error){var p=e,l=p[1];t.observers.forEach(function(t){return t.error(l)})}else r===n.Complete&&(t.cancelSubscriber(),t.cancelSubscriber=u,t.closed=!0,t.observers.splice(0).forEach(function(t){return t.complete()}));i.dispatch(s,o.DispatcherPriorities.OBSERVABLE)},t}();c.awaitingMessages=[],c.lastObservablePriority=0,e.BaseObservable=c},function(t,e){"use strict";var r=function(){function t(){this._isRunning=!1,this.tasks=[]}return Object.defineProperty(t.prototype,"isRunning",{get:function(){return!!this._isRunning},enumerable:!0,configurable:!0}),t.prototype.push=function(t,e){return this.tasks.push({priority:e,execute:t}),this},t.prototype.run=function(){var t=this;this._isRunning||(this._isRunning=!0,Promise.resolve().then(function(){return t.loop()}))},t.prototype.loop=function(){var t=this,e=this.findNextTask();return e?void this.next(e.execute,function(){Promise.resolve().then(function(){return t.loop()})}):void(this._isRunning=!1)},t.prototype.findNextTask=function(){for(var t=null,e=0;this.tasks.length>e;e++)(null===t||this.tasks[t].priority>this.tasks[e].priority)&&(t=e);return null===t?null:this.tasks.splice(t,1)[0]},t.prototype.next=function(t,e){try{t()}catch(t){console.error(t.stack||t.message||t)}e()},t}();e.Dispatcher=r},function(t,e,r){"use strict";function n(t,e,r){var n=r.value;r.value=function(){for(var t=this,e=[],r=0;arguments.length>r;r++)e[r]=arguments[r];return o.dispatchPromise(function(){n.apply(t,e)},i.DispatcherPriorities.DOMAIN)}}var i=r(2),o=r(1);e.action=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},o=r(3),s=r(2),u=r(1),c=function(t){function e(e){var r;return e?r=t.call(this,function(t){e.subscribe(i({},t,{start:function(){}}))})||this:void(r=t.call(this)||this)}return n(e,t),e.tagged=function(t){for(var r=[],n=1;arguments.length>n;n++)r[n-1]=arguments[n];var i=function(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];var o=e.create.apply(void 0,n);return o.name=t.reduce(function(t,e,n){return t+(n>0?r[n-1]:"")+e}),o};return i},e.create=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];var n,i,o;"object"==typeof t[0]&&null!==t[0]&&"function"==typeof t[0].subscribe&&(n=t.shift()),i=t.shift(),o=t.shift();var c=new e(n);if(i){var a=function(t){return Object.prototype.hasOwnProperty.call(i,t)?void(c[t]=function(){for(var e=[],r=0;arguments.length>r;r++)e[r]=arguments[r];return u.dispatchPromise((n=i[t]).bind.apply(n,[c].concat(e)),s.DispatcherPriorities.DOMAIN);var n}):"continue"};for(var f in i)a(f)}if(o)for(var p in o)Object.prototype.hasOwnProperty.call(o,p)&&(c[p]=o[p]);return c},e}(o.Observable);e.Domain=c},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},o=r(3),s=function(t){function e(e){return t.call(this,function(t){var r=[],n=[],o=[],s={},u=[],c=function(c){return Object.prototype.hasOwnProperty.call(e,c)?(r.push(c),void u.push(e[c].subscribe(function(e){if(o&&o.push([c,e]),n.indexOf(c)<0&&n.push(c),r.length===n.length){if(o){for(var u={},a=[],f=[],p=0;o.length>p;p++)if(a.indexOf(o[p][0])<0){var l=o[p],h=l[0],v=l[1];u[h]=v,a.push(h)}else f.push(o[p]);return t.next(s=u),f.forEach(function(e){var r=e[0],n=e[1];t.next(s=i({},s,(o={},o[r]=n,o)));var o}),void(o=null)}t.next(s=i({},s,(b={},b[c]=e,b)));var b}}))):"continue"};for(var a in e)c(a);return function(){u.forEach(function(t){return t()})}})||this}return n(e,t),e}(o.Observable);e.Merge=s},function(t,e){"use strict";var r=function(){function t(t,e){this.customUnsubscribe=t,this.isSubscriptionActive=e}return Object.defineProperty(t.prototype,"closed",{get:function(){return!this.isSubscriptionActive()},enumerable:!0,configurable:!0}),t.prototype.unsubscribe=function(){var t=this.customUnsubscribe;t&&(this.customUnsubscribe=null,t&&t())},t}();e.Subscription=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.immview=e():t.immview=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";var n=r(1);e.Dispatcher=n.Dispatcher;var i=r(2),o=r(3);e.Observable=o.Observable;var s=r(5);e.Combine=s.Combine,e.Merge=s.Combine;var u=r(8);e.Domain=u.Domain;var c=r(7);e.action=c.action;var a=function(t){n.Dispatcher.push(t,i.DispatcherPriorities.EXTERNAL)};e.dispatch=a},function(t,e,r){"use strict";var n=r(6),i=new n.Dispatcher;e.Dispatcher=i;var o=function(t,e){i.push(t,e),i.run()};e.dispatch=o;var s=function(t,e){return new Promise(function(r,n){o(function(){try{r(t())}catch(t){console.error(t.stack||t.message||t),n(t)}},e)})};e.dispatchPromise=s},function(t,e){"use strict";var r;!function(t){t[t.OBSERVABLE=1]="OBSERVABLE",t[t.DOMAIN=2]="DOMAIN",t[t.BUFFER=3]="BUFFER",t[t.EXTERNAL=4]="EXTERNAL",t[t.TEST=10]="TEST"}(r=e.DispatcherPriorities||(e.DispatcherPriorities={}))},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=r(4),o=r(2),s=r(1),u="undefined"!=typeof Symbol?Symbol("ObservableSymbol"):"ObservableSymbol",c=function(t){function e(){return t.apply(this,arguments)||this}return n(e,t),e.of=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];return e.from(t)},e.from=function(t){if(t[u])return new e(function(e){t[u]().subscribe(e.next,e.error,e.complete)});if(t[Symbol.iterator])return new e(function(e){for(var r=e.next,n=e.error,i=e.complete,o=t[Symbol.iterator](),s=o.next();s.done===!1;s=o.next())s.value instanceof Error?n(s.value):r(s.value);i()});throw Error("Observable.from incorrect input")},e.prototype.map=function(t){var r=this;return new e(function(e){var n=r.subscribe(function(r){try{e.next(t(r))}catch(t){e.error(t)}},e.error,e.complete);return function(){return n.unsubscribe()}})},e.prototype.flatten=function(){var t=this;return new e(function(e){t.subscribe(function(t){t&&t.subscribe(function(t){e.next(t)},function(t){return e.error(t)})},e.error,e.complete)})},e.prototype.scan=function(t){var r=this;return new e(function(e){var n,i=0,o=r.subscribe(function(r){try{n=t(n,r,i++),e.next(n)}catch(t){e.error(t)}},e.error,e.complete);return function(){return o.unsubscribe()}})},e.prototype.filter=function(t){var r=this;return new e(function(e){var n=r.subscribe(function(r){try{t(r)&&e.next(r)}catch(t){e.error(t)}},e.error,e.complete);return function(){return n.unsubscribe()}})},e.prototype.bufferCount=function(t,r){var n=this;void 0===r&&(r=null);var i=r||t,o=[];return new e(function(e){var r=n.subscribe(function(r){o.push(r),o.length===t&&(e.next(o.slice()),o=o.splice(i,t-i))},e.error,function(){o.length>t-i&&e.next(o.slice()),e.complete()});return function(){return r.unsubscribe()}})},e.prototype.buffer=function(t){var r=this;void 0===t&&(t=0);var n=[];return new e(function(e){var i=r.subscribe(function(r){n=t>0?[r].concat(n).splice(0,t):[r].concat(n),s.Dispatcher.push(function(){0!==n.length&&e.next(n.splice(0).reverse())},o.DispatcherPriorities.BUFFER).run()},e.error,function(){n.length>0&&e.next(n.splice(0).reverse()),e.complete()});return function(){return i.unsubscribe()}})},e}(i.BaseObservable);e.Observable=c,c.prototype[u]=function(){return this}},function(t,e,r){"use strict";var n,i=r(1),o=r(2),s=r(9);!function(t){t[t.Next=0]="Next",t[t.Error=1]="Error",t[t.Complete=2]="Complete"}(n=e.MessageTypes||(e.MessageTypes={}));var u=function(){},c=function(){function t(e){var r=this;this.closed=!1;var i=this;return this.observers=[],this.priority=t.lastObservablePriority++,e?void(this.cancelSubscriber=e({next:function(t){r.pushMessage([n.Next,"function"==typeof t?t:function(){return t},u])},error:function(t){r.pushMessage([n.Error,t,u])},complete:function(){r.pushMessage([n.Complete,,u])},get closed(){return i.observers.length>0}})||u):void(this.cancelSubscriber=u)}return t.prototype.previous=function(){return this.lastValue},t.prototype.start=function(){},t.prototype.next=function(t){this.pushMessage([n.Next,"function"==typeof t?t:function(){return t},u])},t.prototype.error=function(t){this.pushMessage([n.Error,t,u])},t.prototype.complete=function(){this.pushMessage([n.Complete,,u])},t.prototype.subscribe=function(){for(var e=this,r=[],n=0;arguments.length>n;n++)r[n]=arguments[n];if(this.closed)return new s.Subscription(null,function(){return!1});if("object"!=typeof r[0]||null===r[0]){var i=r[0],o=void 0===i?u:i,c=r[1],a=void 0===c?u:c,f=r[2],p=void 0===f?u:f;return this.subscribe({start:u,next:o,error:a,complete:p})}var l=r[0];this.observers.push(l);var h=new s.Subscription(function(){e.observers=e.observers.filter(function(t){return t!==l})},function(){return e.observers.indexOf(l)>-1});return l.start(h),t.dispatchDigestMessages(),h},t.prototype.pushMessage=function(e){this.closed||(t.awaitingMessages.push([this,e]),t.dispatchDigestMessages())},t.dispatchDigestMessages=function(){i.dispatch(t.digestAwaitingMessages,o.DispatcherPriorities.OBSERVABLE)},t.digestAwaitingMessages=function(){var e=t.popMessage(),r=e[0],n=e[1];r&&!r.closed&&(t.digestNodeMessage(r,n),t.dispatchDigestMessages())},t.popMessage=function(){if(0===t.awaitingMessages.length)return[null,null];for(var e=0;t.awaitingMessages.length>e;e++){var r=t.awaitingMessages[e],n=r[0],i=void 0===n?null:n,o=r[1];if(i.observers.length)return t.awaitingMessages.splice(e,1),[i,o]}return[null,null]},t.digestNodeMessage=function(t,e){var r=e[0],s=e[2];if(r===n.Next){var c=e,a=c[1],f=a(t.lastValue);t.lastValue=f,t.observers.forEach(function(t){return t.next(f)})}else if(r===n.Error){var p=e,l=p[1];t.observers.forEach(function(t){return t.error(l)})}else r===n.Complete&&(t.cancelSubscriber(),t.cancelSubscriber=u,t.closed=!0,t.observers.splice(0).forEach(function(t){return t.complete()}));i.dispatch(s,o.DispatcherPriorities.OBSERVABLE)},t}();c.awaitingMessages=[],c.lastObservablePriority=0,e.BaseObservable=c},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},o=r(3),s=function(t){function e(e){return t.call(this,function(t){var r=[],n=[],o=[],s={},u=[],c=function(c){return Object.prototype.hasOwnProperty.call(e,c)?(r.push(c),void u.push(e[c].subscribe(function(e){if(o&&o.push([c,e]),n.indexOf(c)<0&&n.push(c),r.length===n.length){if(o){for(var u={},a=[],f=[],p=0;o.length>p;p++)if(a.indexOf(o[p][0])<0){var l=o[p],h=l[0],v=l[1];u[h]=v,a.push(h)}else f.push(o[p]);return t.next(s=u),f.forEach(function(e){var r=e[0],n=e[1];t.next(s=i({},s,(o={},o[r]=n,o)));var o}),void(o=null)}t.next(s=i({},s,(b={},b[c]=e,b)));var b}}))):"continue"};for(var a in e)c(a);return function(){u.forEach(function(t){return t()})}})||this}return n(e,t),e}(o.Observable);e.Combine=s},function(t,e){"use strict";var r=function(){function t(){this._isRunning=!1,this.tasks=[]}return Object.defineProperty(t.prototype,"isRunning",{get:function(){return!!this._isRunning},enumerable:!0,configurable:!0}),t.prototype.push=function(t,e){return this.tasks.push({priority:e,execute:t}),this},t.prototype.run=function(){var t=this;this._isRunning||(this._isRunning=!0,Promise.resolve().then(function(){return t.loop()}))},t.prototype.loop=function(){var t=this,e=this.findNextTask();return e?void this.next(e.execute,function(){Promise.resolve().then(function(){return t.loop()})}):void(this._isRunning=!1)},t.prototype.findNextTask=function(){for(var t=null,e=0;this.tasks.length>e;e++)(null===t||this.tasks[t].priority>this.tasks[e].priority)&&(t=e);return null===t?null:this.tasks.splice(t,1)[0]},t.prototype.next=function(t,e){try{t()}catch(t){console.error(t.stack||t.message||t)}e()},t}();e.Dispatcher=r},function(t,e,r){"use strict";function n(t,e,r){var n=r.value;r.value=function(){for(var t=this,e=[],r=0;arguments.length>r;r++)e[r]=arguments[r];return o.dispatchPromise(function(){n.apply(t,e)},i.DispatcherPriorities.DOMAIN)}}var i=r(2),o=r(1);e.action=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=this&&this.__assign||Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},o=r(3),s=r(2),u=r(1),c=function(t){function e(e){var r;return e?r=t.call(this,function(t){e.subscribe(i({},t,{start:function(){}}))})||this:void(r=t.call(this)||this)}return n(e,t),e.tagged=function(t){for(var r=[],n=1;arguments.length>n;n++)r[n-1]=arguments[n];var i=function(){for(var n=[],i=0;arguments.length>i;i++)n[i]=arguments[i];var o=e.create.apply(void 0,n);return o.name=t.reduce(function(t,e,n){return t+(n>0?r[n-1]:"")+e}),o};return i},e.create=function(){for(var t=[],r=0;arguments.length>r;r++)t[r]=arguments[r];var n,i,o;"object"==typeof t[0]&&null!==t[0]&&"function"==typeof t[0].subscribe&&(n=t.shift()),i=t.shift(),o=t.shift();var c=new e(n);if(i){var a=function(t){return Object.prototype.hasOwnProperty.call(i,t)?void(c[t]=function(){for(var e=[],r=0;arguments.length>r;r++)e[r]=arguments[r];return u.dispatchPromise((n=i[t]).bind.apply(n,[c].concat(e)),s.DispatcherPriorities.DOMAIN);var n}):"continue"};for(var f in i)a(f)}if(o)for(var p in o)Object.prototype.hasOwnProperty.call(o,p)&&(c[p]=o[p]);return c},e}(o.Observable);e.Domain=c},function(t,e){"use strict";var r=function(){function t(t,e){this.customUnsubscribe=t,this.isSubscriptionActive=e}return Object.defineProperty(t.prototype,"closed",{get:function(){return!this.isSubscriptionActive()},enumerable:!0,configurable:!0}),t.prototype.unsubscribe=function(){var t=this.customUnsubscribe;t&&(this.customUnsubscribe=null,t&&t())},t}();e.Subscription=r}])}); | ||
//# sourceMappingURL=immview.js.map |
import { Dispatcher } from './DispatcherInstance'; | ||
import { Observable } from './Observable'; | ||
import { Merge } from './Merge'; | ||
import { Combine } from './Combine'; | ||
import { Domain } from './Domain'; | ||
import { action } from './Domain.action'; | ||
declare const dispatchExt: (job: () => any) => void; | ||
export { Observable, Merge, Domain, Dispatcher, dispatchExt as dispatch, action }; | ||
export { Observable, Combine, Combine as Merge, Domain, Dispatcher, dispatchExt as dispatch, action }; |
@@ -7,3 +7,3 @@ import { BaseObservable } from './BaseObservable'; | ||
flatten<U>(this: Observable<Observable<U>>): Observable<U>; | ||
scan<U>(reductor: (summary: U, value: T, index: number) => U): Observable<U>; | ||
scan<U>(reductor: (accumulator: U, value: T, index: number) => U): Observable<U>; | ||
filter(filter: (value: T) => boolean): Observable<T>; | ||
@@ -10,0 +10,0 @@ bufferCount(bufferSize: number, customBufferCount?: number): Observable<T[]>; |
136
docs.md
@@ -1,11 +0,34 @@ | ||
#Docs | ||
<!-- TOC --> | ||
- [Documentation](#documentation) | ||
- [class `Observable`<T>](#class-observablelttgt) | ||
- [Observable::previous](#observableprevious) | ||
- [Observable::next](#observablenext) | ||
- [Observable::error](#observableerror) | ||
- [Observable::complete](#observablecomplete) | ||
- [Observable::subscribe](#observablesubscribe) | ||
- [Observable::map](#observablemap) | ||
- [Observable::filter](#observablefilter) | ||
- [Observable::scan](#observablescan) | ||
- [Observable::flatten](#observableflatten) | ||
- [Observable::buffer](#observablebuffer) | ||
- [Observable::bufferCount](#observablebuffercount) | ||
- [class `Combine`<T> extends `Observable`<T>](#class-combinelttgt-extends-observablelttgt) | ||
- [class `Domain`<T> extends `Observable`<T>](#class-domainlttgt-extends-observablelttgt) | ||
- [Domain.create](#domaincreate) | ||
- [Domain.tagged](#domaintagged) | ||
- [Domain::[ACTION_NAME]](#domainaction_name) | ||
<!-- /TOC --> | ||
# Documentation | ||
## class `Observable`<T> | ||
#### (subscriber: (observer: {next: (value: T) => void, error: (err: Error) => void, complete: () => void}) => void | () => void) | ||
`(subscriber: (observer: {next: (value: T) => void, error: (err: Error) => void, complete: () => void}) => void | () => void)` | ||
Construct with `subscriber` function that receives `observer` object. `Observer` is for pushing values, errors and completion signal. | ||
`Subscriber` function may return function that should be called if `Observable` receives `complete` signal or is cancelled. | ||
### Observable::last | ||
#### () => T | ||
Returns last **value** that has been pushed through the `Observable` instance. | ||
### Observable::previous | ||
`() => T` | ||
Returns previous **value** that has been pushed through the `Observable` instance. | ||
@@ -21,27 +44,88 @@ ```javascript | ||
### Observable::next | ||
#### (nextValue: T) => void | ||
`(nextValue: T) => void` | ||
Sends value signal through the `Observable` instance. Values can be received, by `Observable::subscribe` method or `Observable::previous`. | ||
### Observable::error | ||
#### (error: Error) => void | ||
`(error: Error) => void` | ||
Sends error signal through the `Observable` instance. Errors can be received, with `Observable::subscribe` method. | ||
### Observable::complete | ||
#### () => void | ||
`() => void` | ||
Sends `complete` signal through the `Observable` instance. Completion can be handled, with `Observable::subscribe` method. | ||
### Observable::subscribe | ||
#### ( { start: (sub: Subscription) => void, next: (value: T) => void, error: (err: Error) => void, complete: () => void } ) => () => void | ||
#### ( onNext?: (value: T) => void, onError?: (err: Error) => void, onCompletion?: () => void ) => () => void | ||
`( { start: (sub: Subscription) => void, next: (value: T) => void, error: (err: Error) => void, complete: () => void } ) => () => void` | ||
`( onNext?: (value: T) => void, onError?: (err: Error) => void, onCompletion?: () => void ) => () => void` | ||
Registers a function called every time when the Observable changes value that it holds, error is pushed or Observable is complete. | ||
Returns a function to unregister the subscription. | ||
### Observable::map | ||
`(action: (value: T) => U): Observable<U>` | ||
Creates a derivative stream of values where | ||
every value pushed by a parent is transformed with `action` function and push further by `Observable` - result of this function call. | ||
## class `Merge`<T> | ||
#### extends `Observable`<T> | ||
#### ( { [name: string]: Observable } ) | ||
### Observable::filter | ||
`(filter: (value: T) => boolean): Observable<T>` | ||
Creates a derivative stream of values where | ||
only those values that meet requirements formulated | ||
with `filter` function are going to be pushed by that derivative `Observable`. | ||
### Observable::scan | ||
`(accumulator: (summary: U, value: T, index: number) => U): Observable<U>` | ||
Creates a derivative stream of values where | ||
on every value that parent pushes | ||
there is `accumulator` function called | ||
getting last pushed value and new value that has been pushed by parent `Observable`. | ||
Result of the function is next value of newly created `Observable`. | ||
### Observable::flatten | ||
`(): Observable<U>` | ||
When parent `Observable` is releasing other `Observable`s as values | ||
use `flatten` to create a derivative stream that consists only of values | ||
that are released by these "observable values". | ||
### Observable::buffer | ||
`(maxLastValues: number = 0): Observable<T[]>` | ||
Creates a derivative stream of parent `Observable` values gathered in array. | ||
New values set is released after | ||
all other `Observable`s values are pushed through | ||
and all `Domain` actions being called. | ||
You can specify how many of there messages has to be remembered. | ||
### Observable::bufferCount | ||
`(bufferSize: number, customBufferCount: number = null): Observable<T[]>` | ||
Creates a derivative stream containing parent `Observable` values | ||
gathered in an Array. | ||
New values set is released | ||
every `bufferSize`-th parent `Observable` value or | ||
every `customBufferCount`-th parent `Observable` value | ||
if second argument is present. | ||
As it might be still mysterious how it works | ||
consider these graphical representations | ||
of how values are pushed in time: | ||
``` | ||
const a = Observable.of(1, 2, 3, 4, 5) | ||
const b = a.bufferCount(2) | ||
a --1--2--3--4--5--| | ||
b -----[1,2]-[3,4]-[5]| | ||
``` | ||
``` | ||
const a = Observable.of(1, 2, 3, 4, 5) | ||
const b = a.bufferCount(3, 2) // now with custom window | ||
a --1--2--3----4--5| | ||
b --------[1,2,3]-[3,4,5]| | ||
``` | ||
## class `Combine`<T> extends `Observable`<T> | ||
`( { [name: string]: Observable } )` | ||
Responsible for being reactive to more than one source and placing source streams contents in their respective (according to informations provided upon initialization) field in result object. | ||
```javascript | ||
const join = new Merge({ | ||
const join = new Combine({ | ||
a: new Observable(observer => { observer.next('a') }), | ||
@@ -55,10 +139,9 @@ b: new Observable(observer => { observer.next('b') }) | ||
## class `Domain`<T> | ||
#### extends `Observable`<T> | ||
#### ( source: Observable<T> ) | ||
## class `Domain`<T> extends `Observable`<T> | ||
`( source: Observable<T> )` | ||
Class constructor alone will be only helpful when extending `Domain` class. | ||
### Domain.create<T> | ||
####( source: observable<t> , actions: { [name: string]: () => promise<any> | void }, fields: {}) => Domain | ||
### Domain.create | ||
`( source: observable<t> , actions: { [name: string]: () => promise<any> | void }, fields: {}) => Domain` | ||
@@ -76,3 +159,3 @@ `Domain` class by design is the only thing that should be exported and used (maybe with an exception of type definitions) outside of `Domain`s scope. | ||
First argument of the factory function is an observable emiting messages that will be emited by the `Domain`'s instance too. | ||
Only single data source can be tied to a **Domain**, but you can always use `Merge` to combine multiple streams. | ||
Only single data source can be tied to a **Domain**, but you can always use `Combine` to combine multiple streams. | ||
@@ -86,3 +169,3 @@ Second argument is an object aggregating functions used to create actions and other values that will be exposed as part of the **Domain** interface. | ||
// example usage | ||
import {Merge, Domain} from 'immview' | ||
import {Combine, Domain} from 'immview' | ||
import {HorizonDomain} from './HorizonDomain' | ||
@@ -92,3 +175,3 @@ import {MusclesDomain} from './MusclesDomain' | ||
const EyesDomain = Domain.create( | ||
new Merge({ | ||
new Combine({ | ||
HorizonDomain, | ||
@@ -111,4 +194,4 @@ MusclesDomain, | ||
## Domain.tagged | ||
#### `name` => ( source: observable<t> , actions: { [name: string]: () => promise<any> | void }, fields: {}) => Domain | ||
### Domain.tagged | ||
`name` => `( source: observable<t> , actions: { [name: string]: () => promise<any> | void }, fields: {}) => Domain` | ||
@@ -123,3 +206,6 @@ Basically the same as `Domain.create`, but it returns a function that receives same arguments as `Domain.create`, but creates `Domain` that uses name provided with tagged template string literal. | ||
### Domain::[ACTION_NAME] | ||
function that existed on a set of functions provided as actions in constructor. It is not exactly the same function as it is wrapped, so it is run in **Dispatcher** queue. | ||
`(...args): Promise` | ||
A function that was in a provided in constructor set of actions. | ||
It is **not** exactly the same function as provided, because it is wrapped with internal scheduler call. | ||
Because it's deferred execution **it always returns a Promise** resolved with that function result. | ||
@@ -126,0 +212,0 @@ ```javascript |
{ | ||
"name": "immview", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/immview.js", |
@@ -1,2 +0,2 @@ | ||
# <img src="https://raw.githubusercontent.com/arturkulig/immview/dev-2.0/immview.png" /> | ||
# Immview 2 | ||
@@ -3,0 +3,0 @@ **Immview** is a library to create `Domain`s - *non-visual components* - |
@@ -10,5 +10,7 @@ # Simple usage example | ||
```javascript | ||
import { Data, Domain } from 'immview' | ||
import { Observable, Domain } from 'immview' | ||
const ToDoDomainStream = new Data([]) | ||
const ToDoDomainStream = new Observable( | ||
observer => { observer.next([]) } | ||
) | ||
``` | ||
@@ -25,6 +27,7 @@ | ||
add(label) { | ||
ToDoDomainStream.write( | ||
value => value.push( | ||
{ label, done: false } | ||
) | ||
ToDoDomainStream.next( | ||
todos => [ | ||
{ label, done: false }, | ||
...todos | ||
] | ||
) | ||
@@ -34,11 +37,10 @@ }, | ||
check(index) { | ||
ToDoDomainStream.write( | ||
value => { | ||
const copy = [...value] | ||
copy[index] = { | ||
...value[index], | ||
done: true | ||
} | ||
return copy; | ||
} | ||
ToDoDomainStream.next( | ||
todos => todos.map( | ||
(todo, i) => ( | ||
i === index | ||
? { label: todo.label, done: true } | ||
: todo | ||
) | ||
) | ||
) | ||
@@ -48,5 +50,4 @@ }, | ||
remove(index) { | ||
ToDoDomainStream.write( | ||
value => | ||
value.filter((_, i) => i !== index) | ||
ToDoDomainStream.next( | ||
todos => todos.filter((_, i) => i !== index) | ||
) | ||
@@ -62,3 +63,3 @@ } | ||
```javascript | ||
const ToDoDomain = Domain.new( | ||
const ToDoDomain = Domain.create( | ||
ToDoDomainStream, | ||
@@ -72,20 +73,18 @@ ToDoDomainActions | ||
```javascript | ||
ToDoDomain.read() | ||
ToDoDomain.previous() | ||
// returns: [] | ||
ToDoDomain.subscribe(v => console.log(v)) | ||
// outputs: [] | ||
// and will output every next ToDoDomain's state | ||
// console: [] | ||
ToDoDomain.add('Eat a pizza') | ||
ToDoDomain.read() | ||
// returns: [{ label: "Eat a pizza" }] | ||
// console: [{ label: "Eat a pizza" }] | ||
ToDoDomain.check(0) | ||
ToDoDomain.read() | ||
// returns: [{ label: "Eat a pizza", done: true }] | ||
// console: [{ label: "Eat a pizza", done: true }] | ||
``` | ||
> Please, be aware that all action calls and writes on **Data** instances are going to be dispatched to a execution queue that will run them in call order one after another with prioritization of **Data** writes. This won't be even noticable in this example as calls in it are not nested in a way that would reveal it. | ||
> Please, be aware that all action calls and writes to **Observable** instances are going to be dispatched to a execution queue that will run them in call order one after another with prioritization of **Observable** values pushing. | ||
> This won't be even noticable in this example as calls in it are not nested in a way that would reveal it. | ||
Domain is now ready to be used to connect it a react component using [immview-react-connect](https://github.com/arturkulig/immview-react-connect). |
Sorry, the diff of this file is not supported yet
144620