UNPKG

@code-art/rx-helpers

Version:

A library with Rxjs operators that can be used in your Angular 8 projects.

16 lines (14 loc) 4.54 kB
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@code-art/rx-helpers",["exports","rxjs","rxjs/operators"],n):n(((t=t||self).codeArt=t.codeArt||{},t.codeArt.rxHelpers={}),t.rxjs,t.rxjs.operators)}(this,(function(t,n,e){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var o=function(t,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function r(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var i=Symbol(),u=Symbol();function c(t){return t&&!!t.ɵcmp}function s(t){return t&&!!t.ɵdir}function f(t){return t&&!!t.ɵpipe}function p(){var t=this[i];t&&(t.next(0),t.complete(),this[i]=void 0)}function a(t,n){var e=t.onDestroy;t.onDestroy=function(){e&&e.apply(this),n.apply(this)}}function y(t){var n,e,o;c(t)?a(t.ɵcmp,p):s(t)?a(t.ɵdir,p):f(t)?a(t.ɵpipe,p):(e=p,o=(n=t).prototype.ngOnDestroy,n.prototype.ngOnDestroy=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];o&&o.apply(this,t),e.apply(this)}),t[u]=!0}function l(){return y}function h(t){return function(o){var r=t;return function(t){if(!t[i]){t[i]=new n.Subject;var e=t.constructor;if("function"==typeof e){if(e[u])return;if(f(e)||c(e)||s(e)||(r=e)&&r.ɵprov)throw new Error("To use "+h.name+" with Components, Pipes, Directives and Services add the @"+l.name+".")}if("function"!=typeof t.ngOnDestroy)throw new Error(h.name+" can only be applied to Components, Pipes, Directives and Services with @Injectable decorator or to object instance implementing OnDestroy interface.");var o=t.ngOnDestroy;t.ngOnDestroy=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];o.apply(t,n),p.apply(this)}}var r}(r),o.pipe(e.takeUntil(r[i]))}}var d=function(t){function n(n,e){var o=t.call(this,e)||this;return o._zone=n,o}return r(n,t),n.prototype._next=function(t){var n=this;this._zone.run((function(){"function"==typeof n.destination.next&&n.destination.next(t)}))},n.prototype._error=function(t){var n=this;this._zone.run((function(){"function"==typeof n.destination.error&&n.destination.error(t)}))},n.prototype._complete=function(){var t=this;this._zone.run((function(){"function"==typeof t.destination.complete&&t.destination.complete()}))},n}(n.Subscriber),v=function(){function t(t){this._zone=t}return t.prototype.call=function(t,n){return n.subscribe(new d(this._zone,t))},t}();var _=function(t){function n(n,e){var o=t.call(this,e)||this;return o._zone=n,o}return r(n,t),n.prototype._next=function(t){var n=this;this._zone.runOutsideAngular((function(){"function"==typeof n.destination.next&&n.destination.next(t)}))},n.prototype._error=function(t){var n=this;this._zone.runOutsideAngular((function(){"function"==typeof n.destination.error&&n.destination.error(t)}))},n.prototype._complete=function(){var t=this;this._zone.runOutsideAngular((function(){"function"==typeof t.destination.complete&&t.destination.complete()}))},n}(n.Subscriber),m=function(){function t(t){this._zone=t}return t.prototype.call=function(t,n){return n.subscribe(new _(this._zone,t))},t}();t.TakeUntilDestroyed=l,t.cacheUntil=function(t){return function(o){return t.pipe(e.startWith(0),e.switchMap((function(){return n.defer((function(){return o}))})),e.shareReplay(1))}},t.outsideZone=function(t){return function(n){return n.lift(new m(t))}},t.takeUntilDestroyed=h,t.withZone=function(t){return function(n){return n.lift(new v(t))}},Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=code-art-rx-helpers.umd.min.js.map