blob: 5b0220ba7f2b400b1cd8ce4af87d5f96bb2553b6 [file] [log] [blame]
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/coercion"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/observers",["exports","@angular/cdk/coercion","@angular/core","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.observers={}),e.ng.cdk.coercion,e.ng.core,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var s=function(){function e(){}return e.prototype.create=function(e){return"undefined"==typeof MutationObserver?null:new MutationObserver(e)},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=r.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),i=function(){function e(e){this._mutationObserverFactory=e,this._observedElements=new Map}return e.prototype.ngOnDestroy=function(){var e=this;this._observedElements.forEach(function(t,r){return e._cleanupObserver(r)})},e.prototype.observe=function(e){var r=this,o=t.coerceElement(e);return new n.Observable(function(e){var t=r._observeElement(o),n=t.subscribe(e);return function(){n.unsubscribe(),r._unobserveElement(o)}})},e.prototype._observeElement=function(e){if(this._observedElements.has(e))this._observedElements.get(e).count++;else{var t=new n.Subject,r=this._mutationObserverFactory.create(function(e){return t.next(e)});r&&r.observe(e,{characterData:!0,childList:!0,subtree:!0}),this._observedElements.set(e,{observer:r,stream:t,count:1})}return this._observedElements.get(e).stream},e.prototype._unobserveElement=function(e){this._observedElements.has(e)&&(--this._observedElements.get(e).count||this._cleanupObserver(e))},e.prototype._cleanupObserver=function(e){if(this._observedElements.has(e)){var t=this._observedElements.get(e),r=t.observer,n=t.stream;r&&r.disconnect(),n.complete(),this._observedElements.delete(e)}},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:s}]},e.ngInjectableDef=r.ɵɵdefineInjectable({factory:function(){return new e(r.ɵɵinject(s))},token:e,providedIn:"root"}),e}(),c=function(){function e(e,t,n){this._contentObserver=e,this._elementRef=t,this._ngZone=n,this.event=new r.EventEmitter,this._disabled=!1,this._currentSubscription=null}return Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=t.coerceBooleanProperty(e),this._disabled?this._unsubscribe():this._subscribe()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"debounce",{get:function(){return this._debounce},set:function(e){this._debounce=t.coerceNumberProperty(e),this._subscribe()},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){this._currentSubscription||this.disabled||this._subscribe()},e.prototype.ngOnDestroy=function(){this._unsubscribe()},e.prototype._subscribe=function(){var e=this;this._unsubscribe();var t=this._contentObserver.observe(this._elementRef);this._ngZone.runOutsideAngular(function(){e._currentSubscription=(e.debounce?t.pipe(o.debounceTime(e.debounce)):t).subscribe(e.event)})},e.prototype._unsubscribe=function(){this._currentSubscription&&this._currentSubscription.unsubscribe()},e.decorators=[{type:r.Directive,args:[{selector:"[cdkObserveContent]",exportAs:"cdkObserveContent"}]}],e.ctorParameters=function(){return[{type:i},{type:r.ElementRef},{type:r.NgZone}]},e.propDecorators={event:[{type:r.Output,args:["cdkObserveContent"]}],disabled:[{type:r.Input,args:["cdkObserveContentDisabled"]}],debounce:[{type:r.Input}]},e}(),u=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{exports:[c],declarations:[c],providers:[s]}]}],e}();e.MutationObserverFactory=s,e.ContentObserver=i,e.CdkObserveContent=c,e.ObserversModule=u,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=cdk-observers.umd.min.js.map