|
|
@@ -13,6 +13,8 @@ declare module '@angular/core' {
|
|
|
options?: { attributes: boolean, childList: boolean, characterData: boolean },
|
|
|
params?: { legacy: boolean, timeout?: number }) => () => void;
|
|
|
|
|
|
+ watchChanges: (callback: MutationCallback, options: MutationObserverInit) => () => void;
|
|
|
+
|
|
|
triggerSizeCheck: () => void;
|
|
|
}
|
|
|
}
|
|
|
@@ -32,7 +34,7 @@ const DEFAULT_OPTIONS = {
|
|
|
characterData: true
|
|
|
};
|
|
|
|
|
|
-(ElementRef as any).prototype.watchSize = function
|
|
|
+ElementRef.prototype.watchSize = function
|
|
|
(callback: (height: number, width: number) => void,
|
|
|
options?: { attributes?: boolean, childList?: boolean, characterData?: boolean },
|
|
|
params: { timeout?: number, legacy: boolean } = {legacy: false}) {
|
|
|
@@ -87,8 +89,17 @@ const DEFAULT_OPTIONS = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-(ElementRef as any).prototype.triggerSizeCheck = function () {
|
|
|
+ElementRef.prototype.triggerSizeCheck = function () {
|
|
|
if (this._watchSizeCollection) {
|
|
|
this._watchSizeCollection.call('triggerCheck');
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+ElementRef.prototype.watchChanges = function (callback: MutationCallback, options: MutationObserverInit) {
|
|
|
+ if (MutationObserver) {
|
|
|
+ const observer = new MutationObserver(callback);
|
|
|
+ observer.observe(this.nativeElement, options);
|
|
|
+ return () => observer.disconnect();
|
|
|
+ }
|
|
|
+ return () => {};
|
|
|
+};
|