Utilities to facilitate integration with v8 snapshot builds
import snapshot from '@enact/core/snapshot';
Determines if the
window is available
onWindowReady( callback )undefined
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.
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.
- callback Function
Function to run when the window is ready
Executes all queued window callbacks.
Requires that the window be, in fact, available and will throw an
Error if not.