UNPKG

@obliczeniowo/elementary

Version:
47 lines (43 loc) 1.05 kB
import { BehaviorSubject } from 'rxjs'; import * as i0 from '@angular/core'; interface Size { width: number; height: number; } /** * Service that let you easy react on change of window size * * @example * * constructor(public resize: OblResizeService) { } * * ngOnInit(): void { * this.subscription = this.resize.resized.subscribe((size: Size) => { * this.resize(size); * }); * } * * ngOnDestroy(): void { * if (this.subscription && !this.subscription.closed) { * this.subscription.unsubscribe(); * } * } * * resize(size: Size): void { * console.log(size); * } */ declare class OblResizeWindowService { /** current window size */ size: Size; /** * triggered on window size change */ resized: BehaviorSubject<Size>; constructor(); protected resize(): void; static ɵfac: i0.ɵɵFactoryDeclaration<OblResizeWindowService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<OblResizeWindowService>; } export { OblResizeWindowService }; export type { Size };