import { IFilterModel, IHandlerRegistration } from '../filtermodel'; import { Handler } from '../handler'; export declare class EasyHookSystem { private model; private hooksRegistry; constructor(model: IFilterModel); register(eventName: string, handler: Handler, priority?: number): Promise; series(eventName: string, payload?: T, ...rest: any[]): Promise; /** * emits the event to all handlers parallelly and returns the results generated by each one of them * Note that result array is ordered as handlers priority. * @param eventName the event Name Ex: user_purchase * @param [payload=null] the payload that might be used by handlers. Ex: { amount: 100 } * @returns {Promise} */ do(eventName: string, payload?: T, ...rest: any[]): Promise<{}[]>; /** * sequentially send event out to handlers and returns last handler result * @param eventName the event Name Ex: validate_email * @param [payload=null] the payload sent to first handler: Ex: 'me@andreabaccega.com' * @returns {Promise|Promise} */ map(eventName: string, payload?: T, ...rest: any[]): Promise; map(eventName: string, payload?: T, ...rest: any[]): Promise; /** * emits the event to all handlers parallelly but does not wait for the handlers * to complete their execution. * @param eventName * @param payload * @returns {boolean} */ enqueueDo(eventName: string, payload?: T): true; private getFilter; }