UNPKG

@enact/core

Version:

Enact is an open source JavaScript framework containing everything you need to create a fast, scalable mobile or web application.

31 lines (28 loc) 1.23 kB
// Type definitions for core/snapshot type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N; /** * Determines if the `window` is available */ export function isWindowReady(): boolean; /** * Executes a callback, such as registering event handlers, when a valid `window` is available. * * During normal operation, the callback will be executed immediately. During a pre-rendering pass, the callback is not be executed at all. When using snapshot, the callback is added to a queue and is executed in order once the window is available. * * _Important Notes_ * * The callback should not alter the initial HTML state. If it does, it will invalidate the pre-render state and interfere with React rehydration. * * The callback should be limited to module-scoped actions and not component instance actions. If the action is tied to a component, it should be invoked from within the component's lifecycle methods. */ export function onWindowReady(callback: Function): void; /** * Executes all queued window callbacks. * * Requires that the window be, in fact, available and will throw an `Error` if not. */ export function windowReady(): void;