changeset 19 | 3d72ae0968f4 |
parent 18 | be944660c56a |
child 21 | 48c4eec2b7e6 |
18:be944660c56a | 19:3d72ae0968f4 |
---|---|
1 this["wp"] = this["wp"] || {}; this["wp"]["hooks"] = |
1 /******/ (function() { // webpackBootstrap |
2 /******/ (function(modules) { // webpackBootstrap |
2 /******/ "use strict"; |
3 /******/ // The module cache |
3 /******/ // The require scope |
4 /******/ var installedModules = {}; |
4 /******/ var __webpack_require__ = {}; |
5 /******/ |
5 /******/ |
6 /******/ // The require function |
6 /************************************************************************/ |
7 /******/ function __webpack_require__(moduleId) { |
7 /******/ /* webpack/runtime/define property getters */ |
8 /******/ |
8 /******/ !function() { |
9 /******/ // Check if module is in cache |
9 /******/ // define getter functions for harmony exports |
10 /******/ if(installedModules[moduleId]) { |
10 /******/ __webpack_require__.d = function(exports, definition) { |
11 /******/ return installedModules[moduleId].exports; |
11 /******/ for(var key in definition) { |
12 /******/ } |
12 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
13 /******/ // Create a new module (and put it into the cache) |
13 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
14 /******/ var module = installedModules[moduleId] = { |
14 /******/ } |
15 /******/ i: moduleId, |
15 /******/ } |
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
16 /******/ }; |
19 /******/ |
17 /******/ }(); |
20 /******/ // Execute the module function |
18 /******/ |
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
19 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
22 /******/ |
20 /******/ !function() { |
23 /******/ // Flag the module as loaded |
21 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
24 /******/ module.l = true; |
22 /******/ }(); |
25 /******/ |
23 /******/ |
26 /******/ // Return the exports of the module |
24 /******/ /* webpack/runtime/make namespace object */ |
27 /******/ return module.exports; |
25 /******/ !function() { |
28 /******/ } |
26 /******/ // define __esModule on exports |
29 /******/ |
27 /******/ __webpack_require__.r = function(exports) { |
30 /******/ |
28 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
31 /******/ // expose the modules object (__webpack_modules__) |
29 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
32 /******/ __webpack_require__.m = modules; |
30 /******/ } |
33 /******/ |
31 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
34 /******/ // expose the module cache |
32 /******/ }; |
35 /******/ __webpack_require__.c = installedModules; |
33 /******/ }(); |
36 /******/ |
34 /******/ |
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 /************************************************************************/ |
35 /************************************************************************/ |
88 /******/ ({ |
36 var __webpack_exports__ = {}; |
89 |
|
90 /***/ "gEOj": |
|
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
92 |
|
93 "use strict"; |
|
94 // ESM COMPAT FLAG |
37 // ESM COMPAT FLAG |
95 __webpack_require__.r(__webpack_exports__); |
38 __webpack_require__.r(__webpack_exports__); |
96 |
39 |
97 // EXPORTS |
40 // EXPORTS |
98 __webpack_require__.d(__webpack_exports__, "defaultHooks", function() { return /* binding */ defaultHooks; }); |
41 __webpack_require__.d(__webpack_exports__, { |
99 __webpack_require__.d(__webpack_exports__, "createHooks", function() { return /* reexport */ build_module_createHooks; }); |
42 "actions": function() { return /* binding */ actions; }, |
100 __webpack_require__.d(__webpack_exports__, "addAction", function() { return /* binding */ addAction; }); |
43 "addAction": function() { return /* binding */ addAction; }, |
101 __webpack_require__.d(__webpack_exports__, "addFilter", function() { return /* binding */ addFilter; }); |
44 "addFilter": function() { return /* binding */ addFilter; }, |
102 __webpack_require__.d(__webpack_exports__, "removeAction", function() { return /* binding */ removeAction; }); |
45 "applyFilters": function() { return /* binding */ applyFilters; }, |
103 __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return /* binding */ removeFilter; }); |
46 "createHooks": function() { return /* reexport */ build_module_createHooks; }, |
104 __webpack_require__.d(__webpack_exports__, "hasAction", function() { return /* binding */ hasAction; }); |
47 "currentAction": function() { return /* binding */ currentAction; }, |
105 __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return /* binding */ hasFilter; }); |
48 "currentFilter": function() { return /* binding */ currentFilter; }, |
106 __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return /* binding */ removeAllActions; }); |
49 "defaultHooks": function() { return /* binding */ defaultHooks; }, |
107 __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return /* binding */ removeAllFilters; }); |
50 "didAction": function() { return /* binding */ didAction; }, |
108 __webpack_require__.d(__webpack_exports__, "doAction", function() { return /* binding */ doAction; }); |
51 "didFilter": function() { return /* binding */ didFilter; }, |
109 __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return /* binding */ applyFilters; }); |
52 "doAction": function() { return /* binding */ doAction; }, |
110 __webpack_require__.d(__webpack_exports__, "currentAction", function() { return /* binding */ currentAction; }); |
53 "doingAction": function() { return /* binding */ doingAction; }, |
111 __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return /* binding */ currentFilter; }); |
54 "doingFilter": function() { return /* binding */ doingFilter; }, |
112 __webpack_require__.d(__webpack_exports__, "doingAction", function() { return /* binding */ doingAction; }); |
55 "filters": function() { return /* binding */ filters; }, |
113 __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return /* binding */ doingFilter; }); |
56 "hasAction": function() { return /* binding */ hasAction; }, |
114 __webpack_require__.d(__webpack_exports__, "didAction", function() { return /* binding */ didAction; }); |
57 "hasFilter": function() { return /* binding */ hasFilter; }, |
115 __webpack_require__.d(__webpack_exports__, "didFilter", function() { return /* binding */ didFilter; }); |
58 "removeAction": function() { return /* binding */ removeAction; }, |
116 __webpack_require__.d(__webpack_exports__, "actions", function() { return /* binding */ actions; }); |
59 "removeAllActions": function() { return /* binding */ removeAllActions; }, |
117 __webpack_require__.d(__webpack_exports__, "filters", function() { return /* binding */ filters; }); |
60 "removeAllFilters": function() { return /* binding */ removeAllFilters; }, |
118 |
61 "removeFilter": function() { return /* binding */ removeFilter; } |
119 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js |
62 }); |
63 |
|
64 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js |
|
120 /** |
65 /** |
121 * Validate a namespace string. |
66 * Validate a namespace string. |
122 * |
67 * |
123 * @param {string} namespace The namespace to validate - should take the form |
68 * @param {string} namespace The namespace to validate - should take the form |
124 * `vendor/plugin/function`. |
69 * `vendor/plugin/function`. |
125 * |
70 * |
126 * @return {boolean} Whether the namespace is valid. |
71 * @return {boolean} Whether the namespace is valid. |
127 */ |
72 */ |
128 function validateNamespace(namespace) { |
73 function validateNamespace(namespace) { |
129 if ('string' !== typeof namespace || '' === namespace) { |
74 if ('string' !== typeof namespace || '' === namespace) { |
130 // eslint-disable-next-line no-console |
75 // eslint-disable-next-line no-console |
131 console.error('The namespace must be a non-empty string.'); |
76 console.error('The namespace must be a non-empty string.'); |
141 return true; |
86 return true; |
142 } |
87 } |
143 |
88 |
144 /* harmony default export */ var build_module_validateNamespace = (validateNamespace); |
89 /* harmony default export */ var build_module_validateNamespace = (validateNamespace); |
145 |
90 |
146 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js |
91 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js |
147 /** |
92 /** |
148 * Validate a hookName string. |
93 * Validate a hookName string. |
149 * |
94 * |
150 * @param {string} hookName The hook name to validate. Should be a non empty string containing |
95 * @param {string} hookName The hook name to validate. Should be a non empty string containing |
151 * only numbers, letters, dashes, periods and underscores. Also, |
96 * only numbers, letters, dashes, periods and underscores. Also, |
152 * the hook name cannot begin with `__`. |
97 * the hook name cannot begin with `__`. |
153 * |
98 * |
154 * @return {boolean} Whether the hook name is valid. |
99 * @return {boolean} Whether the hook name is valid. |
155 */ |
100 */ |
156 function validateHookName(hookName) { |
101 function validateHookName(hookName) { |
157 if ('string' !== typeof hookName || '' === hookName) { |
102 if ('string' !== typeof hookName || '' === hookName) { |
158 // eslint-disable-next-line no-console |
103 // eslint-disable-next-line no-console |
159 console.error('The hook name must be a non-empty string.'); |
104 console.error('The hook name must be a non-empty string.'); |
175 return true; |
120 return true; |
176 } |
121 } |
177 |
122 |
178 /* harmony default export */ var build_module_validateHookName = (validateHookName); |
123 /* harmony default export */ var build_module_validateHookName = (validateHookName); |
179 |
124 |
180 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js |
125 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js |
181 /** |
126 /** |
182 * Internal dependencies |
127 * Internal dependencies |
183 */ |
128 */ |
184 |
129 |
185 |
130 |
186 /** |
131 /** |
187 * @callback AddHook |
132 * @callback AddHook |
188 * |
133 * |
189 * Adds the hook to the appropriate hooks container. |
134 * Adds the hook to the appropriate hooks container. |
190 * |
135 * |
191 * @param {string} hookName Name of hook to add |
136 * @param {string} hookName Name of hook to add |
192 * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`. |
137 * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`. |
193 * @param {import('.').Callback} callback Function to call when the hook is run |
138 * @param {import('.').Callback} callback Function to call when the hook is run |
194 * @param {number} [priority=10] Priority of this hook |
139 * @param {number} [priority=10] Priority of this hook |
195 */ |
140 */ |
196 |
141 |
197 /** |
142 /** |
198 * Returns a function which, when invoked, will add a hook. |
143 * Returns a function which, when invoked, will add a hook. |
199 * |
144 * |
200 * @param {import('.').Hooks} hooks Hooks instance. |
145 * @param {import('.').Hooks} hooks Hooks instance. |
201 * @param {import('.').StoreKey} storeKey |
146 * @param {import('.').StoreKey} storeKey |
202 * |
147 * |
203 * @return {AddHook} Function that adds a new hook. |
148 * @return {AddHook} Function that adds a new hook. |
204 */ |
149 */ |
205 |
150 |
206 function createAddHook(hooks, storeKey) { |
151 function createAddHook(hooks, storeKey) { |
207 return function addHook(hookName, namespace, callback, priority = 10) { |
152 return function addHook(hookName, namespace, callback) { |
153 let priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10; |
|
208 const hooksStore = hooks[storeKey]; |
154 const hooksStore = hooks[storeKey]; |
209 |
155 |
210 if (!build_module_validateHookName(hookName)) { |
156 if (!build_module_validateHookName(hookName)) { |
211 return; |
157 return; |
212 } |
158 } |
278 }; |
224 }; |
279 } |
225 } |
280 |
226 |
281 /* harmony default export */ var build_module_createAddHook = (createAddHook); |
227 /* harmony default export */ var build_module_createAddHook = (createAddHook); |
282 |
228 |
283 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js |
229 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js |
284 /** |
230 /** |
285 * Internal dependencies |
231 * Internal dependencies |
286 */ |
232 */ |
287 |
233 |
288 |
234 |
300 |
246 |
301 /** |
247 /** |
302 * Returns a function which, when invoked, will remove a specified hook or all |
248 * Returns a function which, when invoked, will remove a specified hook or all |
303 * hooks by the given name. |
249 * hooks by the given name. |
304 * |
250 * |
305 * @param {import('.').Hooks} hooks Hooks instance. |
251 * @param {import('.').Hooks} hooks Hooks instance. |
306 * @param {import('.').StoreKey} storeKey |
252 * @param {import('.').StoreKey} storeKey |
307 * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName, |
253 * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName, |
308 * without regard to namespace. Used to create |
254 * without regard to namespace. Used to create |
309 * `removeAll*` functions. |
255 * `removeAll*` functions. |
310 * |
256 * |
311 * @return {RemoveHook} Function that removes hooks. |
257 * @return {RemoveHook} Function that removes hooks. |
312 */ |
258 */ |
313 |
259 |
314 function createRemoveHook(hooks, storeKey, removeAll = false) { |
260 function createRemoveHook(hooks, storeKey) { |
261 let removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
|
315 return function removeHook(hookName, namespace) { |
262 return function removeHook(hookName, namespace) { |
316 const hooksStore = hooks[storeKey]; |
263 const hooksStore = hooks[storeKey]; |
317 |
264 |
318 if (!build_module_validateHookName(hookName)) { |
265 if (!build_module_validateHookName(hookName)) { |
319 return; |
266 return; |
320 } |
267 } |
321 |
268 |
322 if (!removeAll && !build_module_validateNamespace(namespace)) { |
269 if (!removeAll && !build_module_validateNamespace(namespace)) { |
323 return; |
270 return; |
324 } // Bail if no hooks exist by this name |
271 } // Bail if no hooks exist by this name. |
325 |
272 |
326 |
273 |
327 if (!hooksStore[hookName]) { |
274 if (!hooksStore[hookName]) { |
328 return 0; |
275 return 0; |
329 } |
276 } |
366 }; |
313 }; |
367 } |
314 } |
368 |
315 |
369 /* harmony default export */ var build_module_createRemoveHook = (createRemoveHook); |
316 /* harmony default export */ var build_module_createRemoveHook = (createRemoveHook); |
370 |
317 |
371 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js |
318 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js |
372 /** |
319 /** |
373 * @callback HasHook |
320 * @callback HasHook |
374 * |
321 * |
375 * Returns whether any handlers are attached for the given hookName and optional namespace. |
322 * Returns whether any handlers are attached for the given hookName and optional namespace. |
376 * |
323 * |
383 |
330 |
384 /** |
331 /** |
385 * Returns a function which, when invoked, will return whether any handlers are |
332 * Returns a function which, when invoked, will return whether any handlers are |
386 * attached to a particular hook. |
333 * attached to a particular hook. |
387 * |
334 * |
388 * @param {import('.').Hooks} hooks Hooks instance. |
335 * @param {import('.').Hooks} hooks Hooks instance. |
389 * @param {import('.').StoreKey} storeKey |
336 * @param {import('.').StoreKey} storeKey |
390 * |
337 * |
391 * @return {HasHook} Function that returns whether any handlers are |
338 * @return {HasHook} Function that returns whether any handlers are |
392 * attached to a particular hook and optional namespace. |
339 * attached to a particular hook and optional namespace. |
393 */ |
340 */ |
394 function createHasHook(hooks, storeKey) { |
341 function createHasHook(hooks, storeKey) { |
403 }; |
350 }; |
404 } |
351 } |
405 |
352 |
406 /* harmony default export */ var build_module_createHasHook = (createHasHook); |
353 /* harmony default export */ var build_module_createHasHook = (createHasHook); |
407 |
354 |
408 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js |
355 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js |
409 /** |
356 /** |
410 * Returns a function which, when invoked, will execute all callbacks |
357 * Returns a function which, when invoked, will execute all callbacks |
411 * registered to a hook of the specified type, optionally returning the final |
358 * registered to a hook of the specified type, optionally returning the final |
412 * value of the call chain. |
359 * value of the call chain. |
413 * |
360 * |
414 * @param {import('.').Hooks} hooks Hooks instance. |
361 * @param {import('.').Hooks} hooks Hooks instance. |
415 * @param {import('.').StoreKey} storeKey |
362 * @param {import('.').StoreKey} storeKey |
416 * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to |
363 * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to |
417 * return its first argument. |
364 * return its first argument. |
418 * |
365 * |
419 * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks. |
366 * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks. |
420 */ |
367 */ |
421 function createRunHook(hooks, storeKey, returnFirstArg = false) { |
368 function createRunHook(hooks, storeKey) { |
422 return function runHooks(hookName, ...args) { |
369 let returnFirstArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
370 return function runHooks(hookName) { |
|
423 const hooksStore = hooks[storeKey]; |
371 const hooksStore = hooks[storeKey]; |
424 |
372 |
425 if (!hooksStore[hookName]) { |
373 if (!hooksStore[hookName]) { |
426 hooksStore[hookName] = { |
374 hooksStore[hookName] = { |
427 handlers: [], |
375 handlers: [], |
432 hooksStore[hookName].runs++; |
380 hooksStore[hookName].runs++; |
433 const handlers = hooksStore[hookName].handlers; // The following code is stripped from production builds. |
381 const handlers = hooksStore[hookName].handlers; // The following code is stripped from production builds. |
434 |
382 |
435 if (false) {} |
383 if (false) {} |
436 |
384 |
385 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
|
386 args[_key - 1] = arguments[_key]; |
|
387 } |
|
388 |
|
437 if (!handlers || !handlers.length) { |
389 if (!handlers || !handlers.length) { |
438 return returnFirstArg ? args[0] : undefined; |
390 return returnFirstArg ? args[0] : undefined; |
439 } |
391 } |
440 |
392 |
441 const hookInfo = { |
393 const hookInfo = { |
464 }; |
416 }; |
465 } |
417 } |
466 |
418 |
467 /* harmony default export */ var build_module_createRunHook = (createRunHook); |
419 /* harmony default export */ var build_module_createRunHook = (createRunHook); |
468 |
420 |
469 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js |
421 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js |
470 /** |
422 /** |
471 * Returns a function which, when invoked, will return the name of the |
423 * Returns a function which, when invoked, will return the name of the |
472 * currently running hook, or `null` if no hook of the given type is currently |
424 * currently running hook, or `null` if no hook of the given type is currently |
473 * running. |
425 * running. |
474 * |
426 * |
475 * @param {import('.').Hooks} hooks Hooks instance. |
427 * @param {import('.').Hooks} hooks Hooks instance. |
476 * @param {import('.').StoreKey} storeKey |
428 * @param {import('.').StoreKey} storeKey |
477 * |
429 * |
478 * @return {() => string | null} Function that returns the current hook name or null. |
430 * @return {() => string | null} Function that returns the current hook name or null. |
479 */ |
431 */ |
480 function createCurrentHook(hooks, storeKey) { |
432 function createCurrentHook(hooks, storeKey) { |
481 return function currentHook() { |
433 return function currentHook() { |
486 }; |
438 }; |
487 } |
439 } |
488 |
440 |
489 /* harmony default export */ var build_module_createCurrentHook = (createCurrentHook); |
441 /* harmony default export */ var build_module_createCurrentHook = (createCurrentHook); |
490 |
442 |
491 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDoingHook.js |
443 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDoingHook.js |
492 /** |
444 /** |
493 * @callback DoingHook |
445 * @callback DoingHook |
494 * Returns whether a hook is currently being executed. |
446 * Returns whether a hook is currently being executed. |
495 * |
447 * |
496 * @param {string} [hookName] The name of the hook to check for. If |
448 * @param {string} [hookName] The name of the hook to check for. If |
497 * omitted, will check for any hook being executed. |
449 * omitted, will check for any hook being executed. |
498 * |
450 * |
499 * @return {boolean} Whether the hook is being executed. |
451 * @return {boolean} Whether the hook is being executed. |
500 */ |
452 */ |
501 |
453 |
502 /** |
454 /** |
503 * Returns a function which, when invoked, will return whether a hook is |
455 * Returns a function which, when invoked, will return whether a hook is |
504 * currently being executed. |
456 * currently being executed. |
505 * |
457 * |
506 * @param {import('.').Hooks} hooks Hooks instance. |
458 * @param {import('.').Hooks} hooks Hooks instance. |
507 * @param {import('.').StoreKey} storeKey |
459 * @param {import('.').StoreKey} storeKey |
508 * |
460 * |
509 * @return {DoingHook} Function that returns whether a hook is currently |
461 * @return {DoingHook} Function that returns whether a hook is currently |
510 * being executed. |
462 * being executed. |
511 */ |
463 */ |
512 function createDoingHook(hooks, storeKey) { |
464 function createDoingHook(hooks, storeKey) { |
522 }; |
474 }; |
523 } |
475 } |
524 |
476 |
525 /* harmony default export */ var build_module_createDoingHook = (createDoingHook); |
477 /* harmony default export */ var build_module_createDoingHook = (createDoingHook); |
526 |
478 |
527 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js |
479 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js |
528 /** |
480 /** |
529 * Internal dependencies |
481 * Internal dependencies |
530 */ |
482 */ |
531 |
483 |
532 /** |
484 /** |
533 * @callback DidHook |
485 * @callback DidHook |
534 * |
486 * |
535 * Returns the number of times an action has been fired. |
487 * Returns the number of times an action has been fired. |
536 * |
488 * |
537 * @param {string} hookName The hook name to check. |
489 * @param {string} hookName The hook name to check. |
538 * |
490 * |
539 * @return {number | undefined} The number of times the hook has run. |
491 * @return {number | undefined} The number of times the hook has run. |
540 */ |
492 */ |
541 |
493 |
542 /** |
494 /** |
543 * Returns a function which, when invoked, will return the number of times a |
495 * Returns a function which, when invoked, will return the number of times a |
544 * hook has been called. |
496 * hook has been called. |
545 * |
497 * |
546 * @param {import('.').Hooks} hooks Hooks instance. |
498 * @param {import('.').Hooks} hooks Hooks instance. |
547 * @param {import('.').StoreKey} storeKey |
499 * @param {import('.').StoreKey} storeKey |
548 * |
500 * |
549 * @return {DidHook} Function that returns a hook's call count. |
501 * @return {DidHook} Function that returns a hook's call count. |
550 */ |
502 */ |
551 |
503 |
552 function createDidHook(hooks, storeKey) { |
504 function createDidHook(hooks, storeKey) { |
561 }; |
513 }; |
562 } |
514 } |
563 |
515 |
564 /* harmony default export */ var build_module_createDidHook = (createDidHook); |
516 /* harmony default export */ var build_module_createDidHook = (createDidHook); |
565 |
517 |
566 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHooks.js |
518 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHooks.js |
567 /** |
519 /** |
568 * Internal dependencies |
520 * Internal dependencies |
569 */ |
521 */ |
570 |
522 |
571 |
523 |
580 * Note, it is necessary to expose this class to make its type public. |
532 * Note, it is necessary to expose this class to make its type public. |
581 * |
533 * |
582 * @private |
534 * @private |
583 */ |
535 */ |
584 |
536 |
585 class createHooks_Hooks { |
537 class _Hooks { |
586 constructor() { |
538 constructor() { |
587 /** @type {import('.').Store} actions */ |
539 /** @type {import('.').Store} actions */ |
588 this.actions = Object.create(null); |
540 this.actions = Object.create(null); |
589 this.actions.__current = []; |
541 this.actions.__current = []; |
590 /** @type {import('.').Store} filters */ |
542 /** @type {import('.').Store} filters */ |
617 * |
569 * |
618 * @return {Hooks} A Hooks instance. |
570 * @return {Hooks} A Hooks instance. |
619 */ |
571 */ |
620 |
572 |
621 function createHooks() { |
573 function createHooks() { |
622 return new createHooks_Hooks(); |
574 return new _Hooks(); |
623 } |
575 } |
624 |
576 |
625 /* harmony default export */ var build_module_createHooks = (createHooks); |
577 /* harmony default export */ var build_module_createHooks = (createHooks); |
626 |
578 |
627 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js |
579 ;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js |
628 /** |
580 /** |
629 * Internal dependencies |
581 * Internal dependencies |
630 */ |
582 */ |
631 |
583 |
632 /** @typedef {(...args: any[])=>any} Callback */ |
584 /** @typedef {(...args: any[])=>any} Callback */ |
683 actions, |
635 actions, |
684 filters |
636 filters |
685 } = defaultHooks; |
637 } = defaultHooks; |
686 |
638 |
687 |
639 |
688 |
640 (window.wp = window.wp || {}).hooks = __webpack_exports__; |
689 /***/ }) |
641 /******/ })() |
690 |
642 ; |
691 /******/ }); |