import { BlueRain } from '../index'; export declare type hookFn = (...args: any[]) => any; /** * All system hooks are stored in this registry */ export default class HookRegistry { private BR; constructor(BR: BlueRain); /** * Add a filter function to a hook. If the listener already exists, it will throw an Error. * @param {string} hook Name of hook (filter/event) to subscribe to * @param {string} name Name of the listener function * @param {Function} filter Listener function */ add(hook: string, name: string, listener: hookFn): void; /** * Sets a filter function to a hook. If the listener already exists, it will be replaced. * @param {string} hook Name of hook (filter/event) to subscribe to * @param {string} name Name of the listener function * @param {Function} filter Listener function */ set(hook: string, name: string, listener: hookFn): void; /** * Checks the params for the `set` and `add` functions * @param {string} hook Name of hook (filter/event) to subscribe to * @param {string} name Name of the listener function * @param {Function} listener Listener function */ checkParams(hook: string, name: string, listener: hookFn): { hook: string; name: string; listener: hookFn; }; /** * Successively run all of a hook's functions on an item * @param {String} hook - First argument: the name of the hook * @param {'async' |'sync' | 'both'} mode - Second argument: mode in which hook will run. * If not given mode will be sync * @param {Any} args - Other arguments will be passed to each successive iteration * @returns {Object} Returns the item after it's been through all the filters for this hook */ run(hook: string, mode?: 'async' | 'sync' | 'both', ...args: any[]): any; }