wp/wp-includes/js/dist/hooks.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    80 /******/ 	// __webpack_public_path__
    80 /******/ 	// __webpack_public_path__
    81 /******/ 	__webpack_require__.p = "";
    81 /******/ 	__webpack_require__.p = "";
    82 /******/
    82 /******/
    83 /******/
    83 /******/
    84 /******/ 	// Load entry module and return exports
    84 /******/ 	// Load entry module and return exports
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 366);
    85 /******/ 	return __webpack_require__(__webpack_require__.s = 449);
    86 /******/ })
    86 /******/ })
    87 /************************************************************************/
    87 /************************************************************************/
    88 /******/ ({
    88 /******/ ({
    89 
    89 
    90 /***/ 366:
    90 /***/ 18:
    91 /***/ (function(module, __webpack_exports__, __webpack_require__) {
    91 /***/ (function(module, __webpack_exports__, __webpack_require__) {
    92 
    92 
    93 "use strict";
    93 "use strict";
       
    94 
       
    95 // EXPORTS
       
    96 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
       
    97 
       
    98 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
       
    99 var arrayLikeToArray = __webpack_require__(26);
       
   100 
       
   101 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
       
   102 
       
   103 function _arrayWithoutHoles(arr) {
       
   104   if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
       
   105 }
       
   106 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
       
   107 var iterableToArray = __webpack_require__(35);
       
   108 
       
   109 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
       
   110 var unsupportedIterableToArray = __webpack_require__(29);
       
   111 
       
   112 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
       
   113 function _nonIterableSpread() {
       
   114   throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
       
   115 }
       
   116 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
       
   117 
       
   118 
       
   119 
       
   120 
       
   121 function _toConsumableArray(arr) {
       
   122   return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
       
   123 }
       
   124 
       
   125 /***/ }),
       
   126 
       
   127 /***/ 26:
       
   128 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   129 
       
   130 "use strict";
       
   131 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
       
   132 function _arrayLikeToArray(arr, len) {
       
   133   if (len == null || len > arr.length) len = arr.length;
       
   134 
       
   135   for (var i = 0, arr2 = new Array(len); i < len; i++) {
       
   136     arr2[i] = arr[i];
       
   137   }
       
   138 
       
   139   return arr2;
       
   140 }
       
   141 
       
   142 /***/ }),
       
   143 
       
   144 /***/ 29:
       
   145 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   146 
       
   147 "use strict";
       
   148 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
       
   149 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
       
   150 
       
   151 function _unsupportedIterableToArray(o, minLen) {
       
   152   if (!o) return;
       
   153   if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
       
   154   var n = Object.prototype.toString.call(o).slice(8, -1);
       
   155   if (n === "Object" && o.constructor) n = o.constructor.name;
       
   156   if (n === "Map" || n === "Set") return Array.from(o);
       
   157   if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
       
   158 }
       
   159 
       
   160 /***/ }),
       
   161 
       
   162 /***/ 35:
       
   163 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   164 
       
   165 "use strict";
       
   166 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
       
   167 function _iterableToArray(iter) {
       
   168   if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
       
   169 }
       
   170 
       
   171 /***/ }),
       
   172 
       
   173 /***/ 449:
       
   174 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   175 
       
   176 "use strict";
       
   177 // ESM COMPAT FLAG
    94 __webpack_require__.r(__webpack_exports__);
   178 __webpack_require__.r(__webpack_exports__);
       
   179 
       
   180 // EXPORTS
       
   181 __webpack_require__.d(__webpack_exports__, "createHooks", function() { return /* reexport */ build_module_createHooks; });
       
   182 __webpack_require__.d(__webpack_exports__, "addAction", function() { return /* binding */ addAction; });
       
   183 __webpack_require__.d(__webpack_exports__, "addFilter", function() { return /* binding */ addFilter; });
       
   184 __webpack_require__.d(__webpack_exports__, "removeAction", function() { return /* binding */ removeAction; });
       
   185 __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return /* binding */ removeFilter; });
       
   186 __webpack_require__.d(__webpack_exports__, "hasAction", function() { return /* binding */ hasAction; });
       
   187 __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return /* binding */ hasFilter; });
       
   188 __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return /* binding */ removeAllActions; });
       
   189 __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return /* binding */ removeAllFilters; });
       
   190 __webpack_require__.d(__webpack_exports__, "doAction", function() { return /* binding */ doAction; });
       
   191 __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return /* binding */ applyFilters; });
       
   192 __webpack_require__.d(__webpack_exports__, "currentAction", function() { return /* binding */ currentAction; });
       
   193 __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return /* binding */ currentFilter; });
       
   194 __webpack_require__.d(__webpack_exports__, "doingAction", function() { return /* binding */ doingAction; });
       
   195 __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return /* binding */ doingFilter; });
       
   196 __webpack_require__.d(__webpack_exports__, "didAction", function() { return /* binding */ didAction; });
       
   197 __webpack_require__.d(__webpack_exports__, "didFilter", function() { return /* binding */ didFilter; });
       
   198 __webpack_require__.d(__webpack_exports__, "actions", function() { return /* binding */ build_module_actions; });
       
   199 __webpack_require__.d(__webpack_exports__, "filters", function() { return /* binding */ build_module_filters; });
    95 
   200 
    96 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js
   201 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js
    97 /**
   202 /**
    98  * Validate a namespace string.
   203  * Validate a namespace string.
    99  *
   204  *
   343  * attached to a particular hook.
   448  * attached to a particular hook.
   344  *
   449  *
   345  * @param  {Object}   hooks Stored hooks, keyed by hook name.
   450  * @param  {Object}   hooks Stored hooks, keyed by hook name.
   346  *
   451  *
   347  * @return {Function}       Function that returns whether any handlers are
   452  * @return {Function}       Function that returns whether any handlers are
   348  *                          attached to a particular hook.
   453  *                          attached to a particular hook and optional namespace.
   349  */
   454  */
   350 function createHasHook(hooks) {
   455 function createHasHook(hooks) {
   351   /**
   456   /**
   352    * Returns how many handlers are attached for the given hook.
   457    * Returns whether any handlers are attached for the given hookName and optional namespace.
   353    *
   458    *
   354    * @param  {string}  hookName The name of the hook to check for.
   459    * @param {string}  hookName  The name of the hook to check for.
       
   460    * @param {?string} namespace Optional. The unique namespace identifying the callback
       
   461    *                                      in the form `vendor/plugin/function`.
   355    *
   462    *
   356    * @return {boolean} Whether there are handlers that are attached to the given hook.
   463    * @return {boolean} Whether there are handlers that are attached to the given hook.
   357    */
   464    */
   358   return function hasHook(hookName) {
   465   return function hasHook(hookName, namespace) {
       
   466     // Use the namespace if provided.
       
   467     if ('undefined' !== typeof namespace) {
       
   468       return hookName in hooks && hooks[hookName].handlers.some(function (hook) {
       
   469         return hook.namespace === namespace;
       
   470       });
       
   471     }
       
   472 
   359     return hookName in hooks;
   473     return hookName in hooks;
   360   };
   474   };
   361 }
   475 }
   362 
   476 
   363 /* harmony default export */ var build_module_createHasHook = (createHasHook);
   477 /* harmony default export */ var build_module_createHasHook = (createHasHook);
   364 
   478 
       
   479 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
       
   480 var toConsumableArray = __webpack_require__(18);
       
   481 
   365 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js
   482 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js
       
   483 
       
   484 
   366 /**
   485 /**
   367  * Returns a function which, when invoked, will execute all callbacks
   486  * Returns a function which, when invoked, will execute all callbacks
   368  * registered to a hook of the specified type, optionally returning the final
   487  * registered to a hook of the specified type, optionally returning the final
   369  * value of the call chain.
   488  * value of the call chain.
   370  *
   489  *
   390         runs: 0
   509         runs: 0
   391       };
   510       };
   392     }
   511     }
   393 
   512 
   394     hooks[hookName].runs++;
   513     hooks[hookName].runs++;
   395     var handlers = hooks[hookName].handlers;
   514     var handlers = hooks[hookName].handlers; // The following code is stripped from production builds.
       
   515 
       
   516     if (false) {}
   396 
   517 
   397     for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
   518     for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
   398       args[_key - 1] = arguments[_key];
   519       args[_key - 1] = arguments[_key];
   399     }
   520     }
   400 
   521 
   569 }
   690 }
   570 
   691 
   571 /* harmony default export */ var build_module_createHooks = (createHooks);
   692 /* harmony default export */ var build_module_createHooks = (createHooks);
   572 
   693 
   573 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js
   694 // CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js
   574 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAction", function() { return addAction; });
       
   575 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFilter", function() { return addFilter; });
       
   576 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAction", function() { return removeAction; });
       
   577 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return removeFilter; });
       
   578 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAction", function() { return hasAction; });
       
   579 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return hasFilter; });
       
   580 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return removeAllActions; });
       
   581 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return removeAllFilters; });
       
   582 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doAction", function() { return doAction; });
       
   583 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return applyFilters; });
       
   584 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentAction", function() { return currentAction; });
       
   585 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return currentFilter; });
       
   586 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingAction", function() { return doingAction; });
       
   587 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return doingFilter; });
       
   588 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didAction", function() { return didAction; });
       
   589 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didFilter", function() { return didFilter; });
       
   590 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "actions", function() { return build_module_actions; });
       
   591 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filters", function() { return build_module_filters; });
       
   592 /* concated harmony reexport createHooks */__webpack_require__.d(__webpack_exports__, "createHooks", function() { return build_module_createHooks; });
       
   593 /**
   695 /**
   594  * Internal dependencies
   696  * Internal dependencies
   595  */
   697  */
   596 
   698 
   597 
   699