@rnaga/wp-node
Version:
👉 **[View Full Documentation at rnaga.github.io/wp-node →](https://rnaga.github.io/wp-node/)**
42 lines • 2.04 kB
TypeScript
import "reflect-metadata";
import { Action } from "./action";
import { Filter } from "./filter";
import type * as types from "../../types";
export declare const FILTER: unique symbol;
export declare const ACTION: unique symbol;
/**
* Represents a class that provides reflection utilities for defining and registering hooks.
*/
export declare class HooksReflect {
/**
* Defines a hook for a given event name with the specified priority.
*
* @param metakey - The metadata key used for storing hook information.
* @param eventName - The name of the event.
* @param priority - The priority of the hook.
* @param args - The arguments containing the target, propertyKey, and descriptor.
*/
private static define;
/**
* Defines a filter hook for a given event name with the specified priority.
* @param eventName - The name of the event.
* @param priority - The priority of the hook.
* @param args - The arguments containing the target, propertyKey, and descriptor.
*/
static defineFilter(eventName: string, priority: number, args: [target: any, propertyKey: string, descriptor: PropertyDescriptor]): void;
/**
* Defines an action hook for a given event name.
* @param eventName - The name of the event.
* @param args - The arguments containing the target, propertyKey, and descriptor.
*/
static defineAction(eventName: string, args: [target: any, propertyKey: string, descriptor: PropertyDescriptor]): void;
/**
* Registers the defined hooks for the given hook types, instance, and target.
*
* @param hookTypes - The hook types to register (filter and action).
* @param instance - The instance containing the hook methods.
* @param target - The target object to register the hooks on.
*/
static register<TFilters = types.hooks.Filters, TActions = types.hooks.Actions>(hookTypes: [Filter<TFilters>, Action<TActions>], instance: any, target: any): void;
}
//# sourceMappingURL=hooks-reflect.d.ts.map