UNPKG

@wordpress/hooks

Version:
63 lines (62 loc) 2.17 kB
import createAddHook from "./createAddHook"; import createRemoveHook from "./createRemoveHook"; import createHasHook from "./createHasHook"; import createRunHook from "./createRunHook"; import createCurrentHook from "./createCurrentHook"; import createDoingHook from "./createDoingHook"; import createDidHook from "./createDidHook"; class _Hooks { actions; filters; addAction; addFilter; removeAction; removeFilter; hasAction; hasFilter; removeAllActions; removeAllFilters; doAction; doActionAsync; applyFilters; applyFiltersAsync; currentAction; currentFilter; doingAction; doingFilter; didAction; didFilter; constructor() { this.actions = /* @__PURE__ */ Object.create(null); this.actions.__current = /* @__PURE__ */ new Set(); this.filters = /* @__PURE__ */ Object.create(null); this.filters.__current = /* @__PURE__ */ new Set(); this.addAction = createAddHook(this, "actions"); this.addFilter = createAddHook(this, "filters"); this.removeAction = createRemoveHook(this, "actions"); this.removeFilter = createRemoveHook(this, "filters"); this.hasAction = createHasHook(this, "actions"); this.hasFilter = createHasHook(this, "filters"); this.removeAllActions = createRemoveHook(this, "actions", true); this.removeAllFilters = createRemoveHook(this, "filters", true); this.doAction = createRunHook(this, "actions", false, false); this.doActionAsync = createRunHook(this, "actions", false, true); this.applyFilters = createRunHook(this, "filters", true, false); this.applyFiltersAsync = createRunHook(this, "filters", true, true); this.currentAction = createCurrentHook(this, "actions"); this.currentFilter = createCurrentHook(this, "filters"); this.doingAction = createDoingHook(this, "actions"); this.doingFilter = createDoingHook(this, "filters"); this.didAction = createDidHook(this, "actions"); this.didFilter = createDidHook(this, "filters"); } } function createHooks() { return new _Hooks(); } var createHooks_default = createHooks; export { _Hooks, createHooks_default as default }; //# sourceMappingURL=createHooks.js.map