Hooks
Hooks allow plugins and integrations to observe or modify behavior at well-defined points in the pipeline.
Use the sections below to find the hook you need, then tap it from the corresponding .hooks object.
AsyncNode
Section titled “AsyncNode”Access pattern: asyncNode.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onAsyncNodeError | SyncBailHook | [Error, Node.Async], anySync hook to manage errors coming from the onAsyncNode hook. Return a fallback node or null to render a fallback. The first argument of passed in the call is the error thrown. |
AsyncNodePlugin
Section titled “AsyncNodePlugin”Access pattern: asyncNodePlugin.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onAsyncNodeError | SyncBailHook | [Error, Node.Async], anySync hook to manage errors coming from the onAsyncNode hook. Return a fallback node or null to render a fallback. The first argument of passed in the call is the error thrown. |
BeaconPlugin
Section titled “BeaconPlugin”Access pattern: beaconPlugin.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
cancelBeacon | SyncBailHook | [HookArgs], boolean |
publishBeacon | SyncHook | [any] |
BindingParser
Section titled “BindingParser”Access pattern: bindingParser.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
beforeResolveNode | SyncWaterfallHook | [AnyNode, BeforeResolveNodeContext] |
skipOptimization | SyncBailHook | [string], boolean |
DataController
Section titled “DataController”Access pattern: dataController.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
deformat | SyncWaterfallHook | [any, BindingInstance] |
format | SyncWaterfallHook | [any, BindingInstance] |
onDelete | SyncHook | [any] |
onGet | SyncHook | [any, any] |
onSet | SyncHook | [BatchSetTransaction] |
onUpdate | SyncHook | [Updates, DataModelOptions | undefined] |
resolve | SyncWaterfallHook | |
resolveDataStages | SyncWaterfallHook | [DataPipeline] |
resolveDefaultValue | SyncBailHook | [BindingInstance], any |
serialize | SyncWaterfallHook | [any] |
ExpressionEvaluator
Section titled “ExpressionEvaluator”Access pattern: expressionEvaluator.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
beforeEvaluate | SyncWaterfallHook | [ExpressionType, HookOptions] |
onError | SyncBailHook | [Error], true |
resolve | SyncWaterfallHook | [any, ExpressionNode, HookOptions] |
resolveOptions | SyncWaterfallHook | [HookOptions] |
FlowController
Section titled “FlowController”Access pattern: flowController.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
flow | SyncHook | [FlowInstance], Record<string, any> |
FlowInstance
Section titled “FlowInstance”Access pattern: flow.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
afterTransition | SyncHook | [FlowInstance], Record<string, any>A callback to run actions after a transition occurs |
beforeStart | SyncBailHook | [NavigationFlow], NavigationFlow, Record<string, any> |
beforeTransition | SyncWaterfallHook | [ ( | NavigationFlowViewState | NavigationFlowFlowState | NavigationFlowActionState | NavigationFlowAsyncActionState | NavigationFlowExternalState ), string, ], Record<string, any>A chance to manipulate the flow-node used to calculate the given transition used |
onEnd | SyncHook | [any], Record<string, any>A callback when the onEnd node was present |
onStart | SyncHook | [any], Record<string, any>A callback when the onStart node was present |
resolveTransitionNode | SyncWaterfallHook | [NavigationFlowState], Record<string, any>A chance to manipulate the flow-node calculated after a transition |
skipTransition | SyncBailHook | [NamedState | undefined], boolean | undefined, Record<string, any>A hook to intercept and block a transition |
transition | SyncHook | [NamedState | undefined, NamedState], Record<string, any>A callback when a transition from 1 state to another was made |
MetricsCorePlugin
Section titled “MetricsCorePlugin”Access pattern: metricsCorePlugin.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onFlowBegin | SyncHook | [PlayerFlowMetrics] |
onFlowEnd | SyncHook | [PlayerFlowMetrics] |
onInteractive | SyncHook | [Timing, PlayerFlowMetrics] |
onNodeEnd | SyncHook | [NodeMetrics | NodeRenderMetrics] |
onNodeStart | SyncHook | [NodeMetrics | NodeRenderMetrics] |
onRenderEnd | SyncHook | [Timing, NodeRenderMetrics, PlayerFlowMetrics] |
onRenderStart | SyncHook | [Timing, NodeRenderMetrics, PlayerFlowMetrics] |
onUpdate | SyncHook | [PlayerFlowMetrics] |
onUpdateEnd | SyncHook | [Timing, NodeRenderMetrics, PlayerFlowMetrics] |
onUpdateStart | SyncHook | [Timing, NodeRenderMetrics, PlayerFlowMetrics] |
resolveRequestTime | SyncBailHook | [], number |
Parser
Section titled “Parser”Access pattern: parser.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onCreateASTNode | SyncWaterfallHook | [Node.Node | undefined | null, object]A callback to interact with an AST after we parse it into the AST |
onParseObject | SyncWaterfallHook | [object, NodeType]A hook to interact with an object before parsing it into an AST |
parseNode | SyncBailHook | [ obj: object, nodeType: Node.ChildrenTypes, parseOptions: ParseObjectOptions, childOptions?: ParseObjectChildOptions, ], Node.Node | Node.Child[]A hook to call when parsing an object into an AST node |
PipelinedDataModel
Section titled “PipelinedDataModel”Access pattern: pipelinedDataModel.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onSet | SyncHook | [BatchSetTransaction] |
Player
Section titled “Player”Access pattern: player.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
bindingParser | SyncHook | [BindingParser], Record<string, any>Manages parsing binding |
dataController | SyncHook | [DataController], Record<string, any>The hook that creates and manages data |
expressionEvaluator | SyncHook | [ExpressionEvaluator], Record<string, any>Called when an expression evaluator was created |
flowController | SyncHook | [FlowController], Record<string, any>The hook that fires every time we create a new flowController (a new Content blob is passed in) |
onEnd | SyncHook | [], Record<string, any>A hook for when the flow ends either in success or failure |
onStart | SyncHook | [Flow<Asset<string>>], Record<string, any>A hook to access the current flow |
resolveFlowContent | SyncWaterfallHook | [Flow<Asset<string>>], Record<string, any>Mutate the Content flow before starting |
schema | SyncHook | [SchemaController], Record<string, any>Called after the schema is created for a flow |
state | SyncHook | [PlayerFlowState], Record<string, any>A that’s called for state changes in the flow execution |
validationController | SyncHook | [ValidationController], Record<string, any>Manages validations (schema and x-field ) |
view | SyncHook | [ViewInstance], Record<string, any>A hook called every-time there’s a new view. This is equivalent to the view hook on the view-controller |
viewController | SyncHook | [ViewController], Record<string, any>The hook that updates/handles views |
ResolveBindingAST
Section titled “ResolveBindingAST”Access pattern: resolveBindingAST.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
beforeResolveNode | SyncWaterfallHook | [AnyNode, Required<NormalizedResult> & ResolveBindingASTOptions]A hook for transforming a node before fully resolving it |
Resolver
Section titled “Resolver”Access pattern: resolver.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
afterNodeUpdate | SyncHook | [Node.Node, Node.Node | undefined, NodeUpdate]Called at the very end of a node’s tree being updated |
afterResolve | SyncWaterfallHook | [any, Node.Node, Resolve.NodeResolveOptions]A hook to transform the resolved value of an AST node. This runs after all children nodes are resolved |
afterUpdate | SyncHook | [any]An event emitted after calculating the next update |
beforeResolve | SyncWaterfallHook | [Node.Node | null, Resolve.NodeResolveOptions]A hook to transform the AST node into a new AST node before resolving it |
beforeUpdate | SyncHook | [Set<BindingInstance> | undefined]An event emitted before calculating the next update |
resolve | SyncWaterfallHook | [any, Node.Node, Resolve.NodeResolveOptions]A hook to transform an AST node into it’s resolved value. This runs before any children are resolved |
resolveOptions | SyncWaterfallHook | [Resolve.NodeResolveOptions, Node.Node]The options passed to a node to resolve it to an object |
skipResolve | SyncWaterfallHook | [boolean, Node.Node, Resolve.NodeResolveOptions]A hook to allow skipping of the resolution tree for a specific node |
SchemaController
Section titled “SchemaController”Access pattern: schema.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
resolveTypeForBinding | SyncWaterfallHook | [SchemaType.DataTypes | undefined, BindingInstance] |
TapableLogger
Section titled “TapableLogger”Access pattern: tapableLogger.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
debug | SyncHook | [Array<any>] |
error | SyncHook | [Array<any>] |
info | SyncHook | [Array<any>] |
log | SyncHook | [Severity, Array<any>] |
trace | SyncHook | [Array<any>] |
warn | SyncHook | [Array<any>] |
TemplatePlugin
Section titled “TemplatePlugin”Access pattern: templatePlugin.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
resolveTemplateSubstitutions | SyncWaterfallHook | [TemplateSubstitution[], TemplateItemInfo] |
ValidationController
Section titled “ValidationController”Access pattern: validation.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
createValidatorRegistry | SyncHook | [ValidatorRegistry] |
onAddValidation | SyncWaterfallHook | [ValidationResponse, BindingInstance] |
onRemoveValidation | SyncWaterfallHook | [ValidationResponse, BindingInstance] |
onTrackBinding | SyncHook | [BindingInstance] |
resolveValidationProviders | SyncWaterfallHook | [ Array<{ source: string; provider: ValidationProvider; }>, ], { view?: ViewInstance; } |
Access pattern: view.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onUpdate | SyncHook | [ViewType]Hook every time there is an update to this view instance |
parser | SyncHook | [Parser]Hook to retrieve the parser used for this view |
resolver | SyncHook | [Resolver]Hook to retrieve the resolver used for this view |
templatePlugin | SyncHook | [TemplatePlugin]Hook to retrieve the template plugin used for this view |
ViewController
Section titled “ViewController”Access pattern: viewController.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
resolveView | SyncWaterfallHook | [View | undefined, string, NavigationFlowViewState]Do any processing before the View instance is created |
view | SyncHook | [ViewInstance]The hook right before the View starts resolving. Attach anything custom here |
ViewInstance
Section titled “ViewInstance”Access pattern: view.hooks.<name>
| Hook | Type | Signature |
|---|---|---|
onUpdate | SyncHook | [ViewType]Hook every time there is an update to this view instance |
parser | SyncHook | [Parser]Hook to retrieve the parser used for this view |
resolver | SyncHook | [Resolver]Hook to retrieve the resolver used for this view |
templatePlugin | SyncHook | [TemplatePlugin]Hook to retrieve the template plugin used for this view |