@snap/camera-kit
Version:
Camera Kit Web
35 lines • 1.27 kB
TypeScript
export declare class PageVisibility {
private onHiddenHandlers;
private onVisibleHandlers;
private previousVisibilityState;
private visibilityTransition;
constructor();
isDuringVisibilityTransition(test: DocumentVisibilityState): boolean;
/**
* Run a function when the page is hidden. If this occurs due to tab / browser closure,
* only synchronous functions will run to completion.
*
* If the given handler throws an error, it will be silently swallowed.
*
* @param handler
* @returns A function which, when called, removes the function from the set of visibility change handlers.
*/
onPageHidden(handler: () => void): () => void;
/**
* Run a function when the page is made visible.
*
* If the given handler throws an error, it will be silently swallowed.
*
* @param handler
* @returns A function which, when called, removes the function from the set of visibility change handlers.
*/
onPageVisible(handler: () => void): () => void;
destroy(): void;
private onVisibilityChange;
}
export declare const pageVisibilityFactory: {
(): PageVisibility;
token: "pageVisibility";
dependencies: [];
};
//# sourceMappingURL=pageVisibility.d.ts.map