@progress/kendo-angular-popup
Version:
Kendo UI Angular Popup component - an easily customized popup from the most trusted provider of professional Angular components.
49 lines (48 loc) • 2.05 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Injectable, NgZone } from '@angular/core';
import { fromEvent } from 'rxjs';
import { auditTime } from 'rxjs/operators';
import { isDocumentAvailable } from '@progress/kendo-angular-common';
import { FRAME_DURATION } from '../util';
import { DOMService } from './dom.service';
import * as i0 from "@angular/core";
import * as i1 from "./dom.service";
/**
* @hidden
*/
export class ResizeService {
_dom;
_zone;
subscription;
constructor(_dom, _zone) {
this._dom = _dom;
this._zone = _zone;
}
subscribe(callback) {
if (!isDocumentAvailable()) {
return;
}
this._zone.runOutsideAngular(() => {
this.subscription = fromEvent(this._dom.getWindow(), "resize")
.pipe(auditTime(FRAME_DURATION))
.subscribe(() => callback());
});
}
unsubscribe() {
if (!this.subscription) {
return;
}
this.subscription.unsubscribe();
}
isUnsubscribed() {
return this.subscription && this.subscription.closed;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ResizeService, deps: [{ token: i1.DOMService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ResizeService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ResizeService, decorators: [{
type: Injectable
}], ctorParameters: function () { return [{ type: i1.DOMService }, { type: i0.NgZone }]; } });