@frshaw1/angular-visibility-api
Version:
An Angular and RxJS enabled event publisher for the browser's visibility API
31 lines (30 loc) • 1.31 kB
TypeScript
/**
* A TypeScript method decorator that will call the annotated method each time the browser visibility is updated.
* The method should accept a single parameter which will correspond the current browser visibility.
*
* Each annotated method will be called immediately at runtime.
*
* @return {(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Function>) => void}
* @constructor
*/
export declare function OnVisibilityChange(): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Function>) => void;
/**
* A TypeScript method decorator that will allow the annotated method to only be called if the browser visibility is
* equal to the specified configuration value upon invocation of the method.
*
* Usage:
*
* ```
* @WhenVisibilityIs(true)
* onlyCallWhenVisible() {
* ...
* //implementation of method that should only be called if the user is
* //currently interacting with the application's browser window
* }
* ```
*
* @param {boolean} specifiedVisibility
* @return {(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Function>) => any}
* @constructor
*/
export declare function WhenVisibilityIs(specifiedVisibility: boolean): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Function>) => void;