Açıklama Yok

hooks.js 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. this["wp"] = this["wp"] || {}; this["wp"]["hooks"] =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "gEOj");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "gEOj":
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. // ESM COMPAT FLAG
  93. __webpack_require__.r(__webpack_exports__);
  94. // EXPORTS
  95. __webpack_require__.d(__webpack_exports__, "defaultHooks", function() { return /* binding */ defaultHooks; });
  96. __webpack_require__.d(__webpack_exports__, "createHooks", function() { return /* reexport */ build_module_createHooks; });
  97. __webpack_require__.d(__webpack_exports__, "addAction", function() { return /* binding */ addAction; });
  98. __webpack_require__.d(__webpack_exports__, "addFilter", function() { return /* binding */ addFilter; });
  99. __webpack_require__.d(__webpack_exports__, "removeAction", function() { return /* binding */ removeAction; });
  100. __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return /* binding */ removeFilter; });
  101. __webpack_require__.d(__webpack_exports__, "hasAction", function() { return /* binding */ hasAction; });
  102. __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return /* binding */ hasFilter; });
  103. __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return /* binding */ removeAllActions; });
  104. __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return /* binding */ removeAllFilters; });
  105. __webpack_require__.d(__webpack_exports__, "doAction", function() { return /* binding */ doAction; });
  106. __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return /* binding */ applyFilters; });
  107. __webpack_require__.d(__webpack_exports__, "currentAction", function() { return /* binding */ currentAction; });
  108. __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return /* binding */ currentFilter; });
  109. __webpack_require__.d(__webpack_exports__, "doingAction", function() { return /* binding */ doingAction; });
  110. __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return /* binding */ doingFilter; });
  111. __webpack_require__.d(__webpack_exports__, "didAction", function() { return /* binding */ didAction; });
  112. __webpack_require__.d(__webpack_exports__, "didFilter", function() { return /* binding */ didFilter; });
  113. __webpack_require__.d(__webpack_exports__, "actions", function() { return /* binding */ actions; });
  114. __webpack_require__.d(__webpack_exports__, "filters", function() { return /* binding */ filters; });
  115. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js
  116. /**
  117. * Validate a namespace string.
  118. *
  119. * @param {string} namespace The namespace to validate - should take the form
  120. * `vendor/plugin/function`.
  121. *
  122. * @return {boolean} Whether the namespace is valid.
  123. */
  124. function validateNamespace(namespace) {
  125. if ('string' !== typeof namespace || '' === namespace) {
  126. // eslint-disable-next-line no-console
  127. console.error('The namespace must be a non-empty string.');
  128. return false;
  129. }
  130. if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
  131. // eslint-disable-next-line no-console
  132. console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.');
  133. return false;
  134. }
  135. return true;
  136. }
  137. /* harmony default export */ var build_module_validateNamespace = (validateNamespace);
  138. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js
  139. /**
  140. * Validate a hookName string.
  141. *
  142. * @param {string} hookName The hook name to validate. Should be a non empty string containing
  143. * only numbers, letters, dashes, periods and underscores. Also,
  144. * the hook name cannot begin with `__`.
  145. *
  146. * @return {boolean} Whether the hook name is valid.
  147. */
  148. function validateHookName(hookName) {
  149. if ('string' !== typeof hookName || '' === hookName) {
  150. // eslint-disable-next-line no-console
  151. console.error('The hook name must be a non-empty string.');
  152. return false;
  153. }
  154. if (/^__/.test(hookName)) {
  155. // eslint-disable-next-line no-console
  156. console.error('The hook name cannot begin with `__`.');
  157. return false;
  158. }
  159. if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
  160. // eslint-disable-next-line no-console
  161. console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.');
  162. return false;
  163. }
  164. return true;
  165. }
  166. /* harmony default export */ var build_module_validateHookName = (validateHookName);
  167. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js
  168. /**
  169. * Internal dependencies
  170. */
  171. /**
  172. * @callback AddHook
  173. *
  174. * Adds the hook to the appropriate hooks container.
  175. *
  176. * @param {string} hookName Name of hook to add
  177. * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
  178. * @param {import('.').Callback} callback Function to call when the hook is run
  179. * @param {number} [priority=10] Priority of this hook
  180. */
  181. /**
  182. * Returns a function which, when invoked, will add a hook.
  183. *
  184. * @param {import('.').Hooks} hooks Hooks instance.
  185. * @param {import('.').StoreKey} storeKey
  186. *
  187. * @return {AddHook} Function that adds a new hook.
  188. */
  189. function createAddHook(hooks, storeKey) {
  190. return function addHook(hookName, namespace, callback, priority = 10) {
  191. const hooksStore = hooks[storeKey];
  192. if (!build_module_validateHookName(hookName)) {
  193. return;
  194. }
  195. if (!build_module_validateNamespace(namespace)) {
  196. return;
  197. }
  198. if ('function' !== typeof callback) {
  199. // eslint-disable-next-line no-console
  200. console.error('The hook callback must be a function.');
  201. return;
  202. } // Validate numeric priority
  203. if ('number' !== typeof priority) {
  204. // eslint-disable-next-line no-console
  205. console.error('If specified, the hook priority must be a number.');
  206. return;
  207. }
  208. const handler = {
  209. callback,
  210. priority,
  211. namespace
  212. };
  213. if (hooksStore[hookName]) {
  214. // Find the correct insert index of the new hook.
  215. const handlers = hooksStore[hookName].handlers;
  216. /** @type {number} */
  217. let i;
  218. for (i = handlers.length; i > 0; i--) {
  219. if (priority >= handlers[i - 1].priority) {
  220. break;
  221. }
  222. }
  223. if (i === handlers.length) {
  224. // If append, operate via direct assignment.
  225. handlers[i] = handler;
  226. } else {
  227. // Otherwise, insert before index via splice.
  228. handlers.splice(i, 0, handler);
  229. } // We may also be currently executing this hook. If the callback
  230. // we're adding would come after the current callback, there's no
  231. // problem; otherwise we need to increase the execution index of
  232. // any other runs by 1 to account for the added element.
  233. hooksStore.__current.forEach(hookInfo => {
  234. if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
  235. hookInfo.currentIndex++;
  236. }
  237. });
  238. } else {
  239. // This is the first hook of its type.
  240. hooksStore[hookName] = {
  241. handlers: [handler],
  242. runs: 0
  243. };
  244. }
  245. if (hookName !== 'hookAdded') {
  246. hooks.doAction('hookAdded', hookName, namespace, callback, priority);
  247. }
  248. };
  249. }
  250. /* harmony default export */ var build_module_createAddHook = (createAddHook);
  251. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js
  252. /**
  253. * Internal dependencies
  254. */
  255. /**
  256. * @callback RemoveHook
  257. * Removes the specified callback (or all callbacks) from the hook with a given hookName
  258. * and namespace.
  259. *
  260. * @param {string} hookName The name of the hook to modify.
  261. * @param {string} namespace The unique namespace identifying the callback in the
  262. * form `vendor/plugin/function`.
  263. *
  264. * @return {number | undefined} The number of callbacks removed.
  265. */
  266. /**
  267. * Returns a function which, when invoked, will remove a specified hook or all
  268. * hooks by the given name.
  269. *
  270. * @param {import('.').Hooks} hooks Hooks instance.
  271. * @param {import('.').StoreKey} storeKey
  272. * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,
  273. * without regard to namespace. Used to create
  274. * `removeAll*` functions.
  275. *
  276. * @return {RemoveHook} Function that removes hooks.
  277. */
  278. function createRemoveHook(hooks, storeKey, removeAll = false) {
  279. return function removeHook(hookName, namespace) {
  280. const hooksStore = hooks[storeKey];
  281. if (!build_module_validateHookName(hookName)) {
  282. return;
  283. }
  284. if (!removeAll && !build_module_validateNamespace(namespace)) {
  285. return;
  286. } // Bail if no hooks exist by this name
  287. if (!hooksStore[hookName]) {
  288. return 0;
  289. }
  290. let handlersRemoved = 0;
  291. if (removeAll) {
  292. handlersRemoved = hooksStore[hookName].handlers.length;
  293. hooksStore[hookName] = {
  294. runs: hooksStore[hookName].runs,
  295. handlers: []
  296. };
  297. } else {
  298. // Try to find the specified callback to remove.
  299. const handlers = hooksStore[hookName].handlers;
  300. for (let i = handlers.length - 1; i >= 0; i--) {
  301. if (handlers[i].namespace === namespace) {
  302. handlers.splice(i, 1);
  303. handlersRemoved++; // This callback may also be part of a hook that is
  304. // currently executing. If the callback we're removing
  305. // comes after the current callback, there's no problem;
  306. // otherwise we need to decrease the execution index of any
  307. // other runs by 1 to account for the removed element.
  308. hooksStore.__current.forEach(hookInfo => {
  309. if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
  310. hookInfo.currentIndex--;
  311. }
  312. });
  313. }
  314. }
  315. }
  316. if (hookName !== 'hookRemoved') {
  317. hooks.doAction('hookRemoved', hookName, namespace);
  318. }
  319. return handlersRemoved;
  320. };
  321. }
  322. /* harmony default export */ var build_module_createRemoveHook = (createRemoveHook);
  323. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js
  324. /**
  325. * @callback HasHook
  326. *
  327. * Returns whether any handlers are attached for the given hookName and optional namespace.
  328. *
  329. * @param {string} hookName The name of the hook to check for.
  330. * @param {string} [namespace] Optional. The unique namespace identifying the callback
  331. * in the form `vendor/plugin/function`.
  332. *
  333. * @return {boolean} Whether there are handlers that are attached to the given hook.
  334. */
  335. /**
  336. * Returns a function which, when invoked, will return whether any handlers are
  337. * attached to a particular hook.
  338. *
  339. * @param {import('.').Hooks} hooks Hooks instance.
  340. * @param {import('.').StoreKey} storeKey
  341. *
  342. * @return {HasHook} Function that returns whether any handlers are
  343. * attached to a particular hook and optional namespace.
  344. */
  345. function createHasHook(hooks, storeKey) {
  346. return function hasHook(hookName, namespace) {
  347. const hooksStore = hooks[storeKey]; // Use the namespace if provided.
  348. if ('undefined' !== typeof namespace) {
  349. return hookName in hooksStore && hooksStore[hookName].handlers.some(hook => hook.namespace === namespace);
  350. }
  351. return hookName in hooksStore;
  352. };
  353. }
  354. /* harmony default export */ var build_module_createHasHook = (createHasHook);
  355. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js
  356. /**
  357. * Returns a function which, when invoked, will execute all callbacks
  358. * registered to a hook of the specified type, optionally returning the final
  359. * value of the call chain.
  360. *
  361. * @param {import('.').Hooks} hooks Hooks instance.
  362. * @param {import('.').StoreKey} storeKey
  363. * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to
  364. * return its first argument.
  365. *
  366. * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks.
  367. */
  368. function createRunHook(hooks, storeKey, returnFirstArg = false) {
  369. return function runHooks(hookName, ...args) {
  370. const hooksStore = hooks[storeKey];
  371. if (!hooksStore[hookName]) {
  372. hooksStore[hookName] = {
  373. handlers: [],
  374. runs: 0
  375. };
  376. }
  377. hooksStore[hookName].runs++;
  378. const handlers = hooksStore[hookName].handlers; // The following code is stripped from production builds.
  379. if (false) {}
  380. if (!handlers || !handlers.length) {
  381. return returnFirstArg ? args[0] : undefined;
  382. }
  383. const hookInfo = {
  384. name: hookName,
  385. currentIndex: 0
  386. };
  387. hooksStore.__current.push(hookInfo);
  388. while (hookInfo.currentIndex < handlers.length) {
  389. const handler = handlers[hookInfo.currentIndex];
  390. const result = handler.callback.apply(null, args);
  391. if (returnFirstArg) {
  392. args[0] = result;
  393. }
  394. hookInfo.currentIndex++;
  395. }
  396. hooksStore.__current.pop();
  397. if (returnFirstArg) {
  398. return args[0];
  399. }
  400. };
  401. }
  402. /* harmony default export */ var build_module_createRunHook = (createRunHook);
  403. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js
  404. /**
  405. * Returns a function which, when invoked, will return the name of the
  406. * currently running hook, or `null` if no hook of the given type is currently
  407. * running.
  408. *
  409. * @param {import('.').Hooks} hooks Hooks instance.
  410. * @param {import('.').StoreKey} storeKey
  411. *
  412. * @return {() => string | null} Function that returns the current hook name or null.
  413. */
  414. function createCurrentHook(hooks, storeKey) {
  415. return function currentHook() {
  416. var _hooksStore$__current, _hooksStore$__current2;
  417. const hooksStore = hooks[storeKey];
  418. return (_hooksStore$__current = (_hooksStore$__current2 = hooksStore.__current[hooksStore.__current.length - 1]) === null || _hooksStore$__current2 === void 0 ? void 0 : _hooksStore$__current2.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null;
  419. };
  420. }
  421. /* harmony default export */ var build_module_createCurrentHook = (createCurrentHook);
  422. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDoingHook.js
  423. /**
  424. * @callback DoingHook
  425. * Returns whether a hook is currently being executed.
  426. *
  427. * @param {string} [hookName] The name of the hook to check for. If
  428. * omitted, will check for any hook being executed.
  429. *
  430. * @return {boolean} Whether the hook is being executed.
  431. */
  432. /**
  433. * Returns a function which, when invoked, will return whether a hook is
  434. * currently being executed.
  435. *
  436. * @param {import('.').Hooks} hooks Hooks instance.
  437. * @param {import('.').StoreKey} storeKey
  438. *
  439. * @return {DoingHook} Function that returns whether a hook is currently
  440. * being executed.
  441. */
  442. function createDoingHook(hooks, storeKey) {
  443. return function doingHook(hookName) {
  444. const hooksStore = hooks[storeKey]; // If the hookName was not passed, check for any current hook.
  445. if ('undefined' === typeof hookName) {
  446. return 'undefined' !== typeof hooksStore.__current[0];
  447. } // Return the __current hook.
  448. return hooksStore.__current[0] ? hookName === hooksStore.__current[0].name : false;
  449. };
  450. }
  451. /* harmony default export */ var build_module_createDoingHook = (createDoingHook);
  452. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js
  453. /**
  454. * Internal dependencies
  455. */
  456. /**
  457. * @callback DidHook
  458. *
  459. * Returns the number of times an action has been fired.
  460. *
  461. * @param {string} hookName The hook name to check.
  462. *
  463. * @return {number | undefined} The number of times the hook has run.
  464. */
  465. /**
  466. * Returns a function which, when invoked, will return the number of times a
  467. * hook has been called.
  468. *
  469. * @param {import('.').Hooks} hooks Hooks instance.
  470. * @param {import('.').StoreKey} storeKey
  471. *
  472. * @return {DidHook} Function that returns a hook's call count.
  473. */
  474. function createDidHook(hooks, storeKey) {
  475. return function didHook(hookName) {
  476. const hooksStore = hooks[storeKey];
  477. if (!build_module_validateHookName(hookName)) {
  478. return;
  479. }
  480. return hooksStore[hookName] && hooksStore[hookName].runs ? hooksStore[hookName].runs : 0;
  481. };
  482. }
  483. /* harmony default export */ var build_module_createDidHook = (createDidHook);
  484. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHooks.js
  485. /**
  486. * Internal dependencies
  487. */
  488. /**
  489. * Internal class for constructing hooks. Use `createHooks()` function
  490. *
  491. * Note, it is necessary to expose this class to make its type public.
  492. *
  493. * @private
  494. */
  495. class createHooks_Hooks {
  496. constructor() {
  497. /** @type {import('.').Store} actions */
  498. this.actions = Object.create(null);
  499. this.actions.__current = [];
  500. /** @type {import('.').Store} filters */
  501. this.filters = Object.create(null);
  502. this.filters.__current = [];
  503. this.addAction = build_module_createAddHook(this, 'actions');
  504. this.addFilter = build_module_createAddHook(this, 'filters');
  505. this.removeAction = build_module_createRemoveHook(this, 'actions');
  506. this.removeFilter = build_module_createRemoveHook(this, 'filters');
  507. this.hasAction = build_module_createHasHook(this, 'actions');
  508. this.hasFilter = build_module_createHasHook(this, 'filters');
  509. this.removeAllActions = build_module_createRemoveHook(this, 'actions', true);
  510. this.removeAllFilters = build_module_createRemoveHook(this, 'filters', true);
  511. this.doAction = build_module_createRunHook(this, 'actions');
  512. this.applyFilters = build_module_createRunHook(this, 'filters', true);
  513. this.currentAction = build_module_createCurrentHook(this, 'actions');
  514. this.currentFilter = build_module_createCurrentHook(this, 'filters');
  515. this.doingAction = build_module_createDoingHook(this, 'actions');
  516. this.doingFilter = build_module_createDoingHook(this, 'filters');
  517. this.didAction = build_module_createDidHook(this, 'actions');
  518. this.didFilter = build_module_createDidHook(this, 'filters');
  519. }
  520. }
  521. /** @typedef {_Hooks} Hooks */
  522. /**
  523. * Returns an instance of the hooks object.
  524. *
  525. * @return {Hooks} A Hooks instance.
  526. */
  527. function createHooks() {
  528. return new createHooks_Hooks();
  529. }
  530. /* harmony default export */ var build_module_createHooks = (createHooks);
  531. // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js
  532. /**
  533. * Internal dependencies
  534. */
  535. /** @typedef {(...args: any[])=>any} Callback */
  536. /**
  537. * @typedef Handler
  538. * @property {Callback} callback The callback
  539. * @property {string} namespace The namespace
  540. * @property {number} priority The namespace
  541. */
  542. /**
  543. * @typedef Hook
  544. * @property {Handler[]} handlers Array of handlers
  545. * @property {number} runs Run counter
  546. */
  547. /**
  548. * @typedef Current
  549. * @property {string} name Hook name
  550. * @property {number} currentIndex The index
  551. */
  552. /**
  553. * @typedef {Record<string, Hook> & {__current: Current[]}} Store
  554. */
  555. /**
  556. * @typedef {'actions' | 'filters'} StoreKey
  557. */
  558. /**
  559. * @typedef {import('./createHooks').Hooks} Hooks
  560. */
  561. const defaultHooks = build_module_createHooks();
  562. const {
  563. addAction,
  564. addFilter,
  565. removeAction,
  566. removeFilter,
  567. hasAction,
  568. hasFilter,
  569. removeAllActions,
  570. removeAllFilters,
  571. doAction,
  572. applyFilters,
  573. currentAction,
  574. currentFilter,
  575. doingAction,
  576. doingFilter,
  577. didAction,
  578. didFilter,
  579. actions,
  580. filters
  581. } = defaultHooks;
  582. /***/ })
  583. /******/ });