UNPKG

jslib-nightly

Version:

SheerID JavaScript Library

38 lines (37 loc) 1.36 kB
import { RegisteredHooks, Hook, HookName } from '../types/types'; /** * @description Register a callback function (a "hook") that will be called for a given hook name. * Hook names are called at specific points during execution and allow some form of extensibility. * @param hookName A specific string, one of the HookName type. * @param callback The function to call when the system performs certain actions, described by the hook's name. */ export declare const addHook: (hook: Hook) => RegisteredHooks; /** * @description Remove a hook * @param hookName A specific string, one of the HookName type. * @private */ export declare const removeHook: (hook: HookName) => RegisteredHooks; /** * @description Retrieve a hook object that has been stored. * @param hookName */ export declare const getHook: (hookName: HookName) => Function; /** * Used for unit testing * @private */ export declare const resetHooks: () => void; /** * Used for unit testing * @private */ export declare const getHooks: () => RegisteredHooks; /** * @description Look for an array of Hook objects that a developer may have provided in the window.sheerId object. * If present, add each to the internal registry of hooks. * * @private * @returns true if any hooks were successfully registered. */ export declare const addPredefinedHooks: () => boolean;