Skip to content

@salesforce/b2c-tooling-sdk / plugins / invokeHook

Function: invokeHook() ​

invokeHook<TResult>(hookFilePath, context, hookOptions, logger?): Promise<TResult | undefined>

Defined in: packages/b2c-tooling-sdk/src/plugins/loader.ts:72

Dynamically imports a hook file and invokes its default export.

Type Parameters ​

TResult ​

TResult

Parameters ​

hookFilePath ​

string

Absolute path to the hook JS file

context ​

HookContext

Hook context (this inside the hook)

hookOptions ​

Record<string, unknown>

Options passed as the first argument to the hook function

logger? ​

Logger

Optional logger for warnings on failure

Returns ​

Promise<TResult | undefined>

The hook function's return value, or undefined on error

Released under the Apache-2.0 License.