UNPKG

@flywine93/ngx-autounsubscrb

Version:

Angular 9+ automatically unsubscribe to the RXJS decorator, It is lightweight and practical!!

16 lines (14 loc) 2.78 kB
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define("@flywine93/ngx-autounsubscrb",["exports"],r):r(((t=t||self).flywine93=t.flywine93||{},t.flywine93["ngx-autounsubscrb"]={}))}(this,(function(t){"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. ***************************************************************************** */function r(t){var r="function"==typeof Symbol&&Symbol.iterator,o=r&&t[r],e=0;if(o)return o.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}var o="ɵdir",e="ɵcmp",n=function(t){return"function"==typeof t},i={blackList:[],checkArrVar:!1};function u(t,o){var e,i;if(t){if(n(t.unsubscribe))return void t.unsubscribe();if(o.checkArrVar&&Array.isArray(t))try{for(var u=r(t),s=u.next();!s.done;s=u.next()){var c=s.value;c&&n(c.unsubscribe)&&c.unsubscribe()}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=u.return)&&i.call(u)}finally{if(e)throw e.error}}}}t.AutoUnsubscrb=function(t){return void 0===t&&(t={}),function(s){var c=s.prototype.ngOnDestroy;if(!n(c))throw new Error(s.name+" is using @AutoUnsubscrb but does not implement OnDestroy");t=Object.assign(i,t),s.prototype.autoAddList=[],s.prototype.ngOnDestroy=function(){var o,e;for(var i in n(c)&&c.apply(this,arguments),this)t.blackList.includes(i)||u(this[i],t);try{for(var s=r(this.autoAddList),f=s.next();!f.done;f=s.next()){var a=f.value;u(a,t)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(e=s.return)&&e.call(s)}finally{if(o)throw o.error}}},s.prototype.constructor[e]?s.prototype.constructor[e].onDestroy=s.prototype.ngOnDestroy:s.prototype.constructor[o]&&(s.prototype.constructor[o].onDestroy=s.prototype.ngOnDestroy)}},t.MAutoAdd=function(t,r){t&&t.autoAddList&&t.autoAddList.push(r)},t.unsubscribe=u,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=flywine93-ngx-autounsubscrb.umd.min.js.map