import { BalWindowResizeListener } from "./window-resize.listener";
import { SingleSubject } from "../types/signal";
import { balBrowser } from "../browser";
export class BalWindowResizeSubject extends SingleSubject {
    constructor() {
        super((observer, _data) => {
            observer.windowResizeListener();
        });
        this.listener = new BalWindowResizeListener();
    }
    attach(observer) {
        super.attach(observer);
        if (balBrowser.hasWindow) {
            this.listener.connect(window);
            this.listener.add(() => super.notify());
        }
    }
    detach() {
        super.detach();
        this.listener.disconnect();
    }
}
export const balWindowResizeSubject = new BalWindowResizeSubject();
