core/snapshot

Utilities to facilitate integration with v8 snapshot builds

import snapshot from '@enact/core/snapshot';

Members

isWindowReadyFunction

isWindowReady(  )Boolean

Determines if the window is available

Returns
Boolean

true when window is ready

onWindowReadyFunction

onWindowReady( callback )

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.

1 Param
callback Function

Function to run when the window is ready

windowReadyFunction

windowReady(  )

Executes all queued window callbacks.

Requires that the window be, in fact, available and will throw an Error if not.

ArrayBooleanFunctionModuleNumberObjectString