UNPKG

@studiohyperdrive/ngx-utils

Version:

A series of abstracts, utils, pipes and services for Angular applications.

60 lines (59 loc) 1.87 kB
import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; /** * @deprecated: This service has been deprecated in favor of the one in @studiohyperdrive/ngx-core */ export declare class WindowService { document: Document; private platformId; private widthSubject$; private scrollingUpSubject$; private currentScrollPositionSubject$; /** * Observable to get the window-width, defaults to 1200 when no window is defined */ width$: Observable<number>; /** * Observable to track when the scroll has ended */ scrollingUp$: Observable<boolean>; /** * Observable of the current scroll position after the scroll has ended */ currentScrollPosition$: Observable<number>; /** * Current scroll position after the scroll has ended */ currentScrollPosition: number; /** * The platforms Window object */ window: Window; constructor(document: Document, platformId: string); /** * Scrolls to the provided position of the page * * @param offset - Offset to which we want to scroll, scrolls to top when no offset is provided */ scrollTo(offset?: number): void; /** * Returns whether there is a document present */ hasDocument(): boolean; /** * Returns whether the current platform is a browser */ isBrowser(): boolean; /** * Run a provided function only when we're in the browser and not in a server side rendered application * * @param action - Function we want to run in the browser */ runInBrowser(action: (data: { browserWindow: Window; browserDocument: Document; }) => void): void; private handleContentScroll; static ɵfac: i0.ɵɵFactoryDeclaration<WindowService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<WindowService>; }