UNPKG

ngx-subscribe

Version:

Subscribe decorator to be used in Angular 2+ components, it will automatically subscribe and cleanup observables to component properties.

2 lines 1.99 kB
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("ngx-subscribe",[],n):"object"==typeof exports?exports["ngx-subscribe"]=n():e["ngx-subscribe"]=n()}(this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var u=t[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,n),u.l=!0,u.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(2);n.Subscribe=r.Subscribe},function(e,n,t){"use strict";function r(e,n,t){e.__value||(e.__value={}),e.__value[n]!==t&&(e.__value[n]=t,e.changeDetector&&e.changeDetector.markForCheck())}function u(e){return!!(e&&e.constructor&&e.call&&e.apply)}function o(e,n,t){return e.__value?e.__value[n]:u(t)?t():t}function s(e,n,t){e.__subs||(e.__subs={}),e.__subs[n]=t.subscribe(function(t){return r(e,n,t)})}function c(e,n){if(e.__subs){var t=e.__subs[n];t&&(t.unsubscribe(),delete e.__subs[n])}}function i(){var e=this;if(e.__subs)for(var n=0,t=Object.getOwnPropertyNames(e.__subs);n<t.length;n++){var r=t[n];e.__subs[r].unsubscribe()}}function _(){var e=this;e.__ngOnDestroy&&e.__ngOnDestroy(),e.__unsubscribeAll()}function b(e){return!!e&&"function"==typeof e.subscribe}function f(e){return function(n,t){var u=n.constructor.prototype;if(!u.__unsubscribeAll){var f=u.ngOnDestroy;f&&(u.__ngOnDestroy=f),u.__unsubscribeAll=i,u.ngOnDestroy=_}return{get:function(){return o(this,t,e)},set:function(e){var n=this;c(n,t),b(e)?s(n,t,e):r(n,t,e)}}}}Object.defineProperty(n,"__esModule",{value:!0}),n.Subscribe=f}])}); //# sourceMappingURL=ngx-subscribe.umd.min.js.map