[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/js/dist/ -> hooks.js (source)

   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 = "./node_modules/@wordpress/hooks/build-module/index.js");
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ "./node_modules/@wordpress/hooks/build-module/createAddHook.js":
  91  /*!*********************************************************************!*\
  92    !*** ./node_modules/@wordpress/hooks/build-module/createAddHook.js ***!
  93    \*********************************************************************/
  94  /*! exports provided: default */
  95  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  96  
  97  "use strict";
  98  __webpack_require__.r(__webpack_exports__);
  99  /* harmony import */ var _validateNamespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validateNamespace.js */ "./node_modules/@wordpress/hooks/build-module/validateNamespace.js");
 100  /* harmony import */ var _validateHookName_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateHookName.js */ "./node_modules/@wordpress/hooks/build-module/validateHookName.js");
 101  /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ */ "./node_modules/@wordpress/hooks/build-module/index.js");
 102  
 103  
 104  
 105  /**
 106   * Returns a function which, when invoked, will add a hook.
 107   *
 108   * @param  {Object}   hooks Stored hooks, keyed by hook name.
 109   *
 110   * @return {Function}       Function that adds a new hook.
 111   */
 112  
 113  function createAddHook(hooks) {
 114    /**
 115     * Adds the hook to the appropriate hooks container.
 116     *
 117     * @param {string}   hookName  Name of hook to add
 118     * @param {string}   namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
 119     * @param {Function} callback  Function to call when the hook is run
 120     * @param {?number}  priority  Priority of this hook (default=10)
 121     */
 122    return function addHook(hookName, namespace, callback) {
 123      var priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
 124  
 125      if (!Object(_validateHookName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(hookName)) {
 126        return;
 127      }
 128  
 129      if (!Object(_validateNamespace_js__WEBPACK_IMPORTED_MODULE_0__["default"])(namespace)) {
 130        return;
 131      }
 132  
 133      if ('function' !== typeof callback) {
 134        // eslint-disable-next-line no-console
 135        console.error('The hook callback must be a function.');
 136        return;
 137      } // Validate numeric priority
 138  
 139  
 140      if ('number' !== typeof priority) {
 141        // eslint-disable-next-line no-console
 142        console.error('If specified, the hook priority must be a number.');
 143        return;
 144      }
 145  
 146      var handler = {
 147        callback: callback,
 148        priority: priority,
 149        namespace: namespace
 150      };
 151  
 152      if (hooks[hookName]) {
 153        // Find the correct insert index of the new hook.
 154        var handlers = hooks[hookName].handlers;
 155        var i = 0;
 156  
 157        while (i < handlers.length) {
 158          if (handlers[i].priority > priority) {
 159            break;
 160          }
 161  
 162          i++;
 163        } // Insert (or append) the new hook.
 164  
 165  
 166        handlers.splice(i, 0, handler); // We may also be currently executing this hook.  If the callback
 167        // we're adding would come after the current callback, there's no
 168        // problem; otherwise we need to increase the execution index of
 169        // any other runs by 1 to account for the added element.
 170  
 171        (hooks.__current || []).forEach(function (hookInfo) {
 172          if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
 173            hookInfo.currentIndex++;
 174          }
 175        });
 176      } else {
 177        // This is the first hook of its type.
 178        hooks[hookName] = {
 179          handlers: [handler],
 180          runs: 0
 181        };
 182      }
 183  
 184      if (hookName !== 'hookAdded') {
 185        Object(___WEBPACK_IMPORTED_MODULE_2__["doAction"])('hookAdded', hookName, namespace, callback, priority);
 186      }
 187    };
 188  }
 189  
 190  /* harmony default export */ __webpack_exports__["default"] = (createAddHook);
 191  
 192  
 193  /***/ }),
 194  
 195  /***/ "./node_modules/@wordpress/hooks/build-module/createCurrentHook.js":
 196  /*!*************************************************************************!*\
 197    !*** ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js ***!
 198    \*************************************************************************/
 199  /*! exports provided: default */
 200  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 201  
 202  "use strict";
 203  __webpack_require__.r(__webpack_exports__);
 204  /**
 205   * Returns a function which, when invoked, will return the name of the
 206   * currently running hook, or `null` if no hook of the given type is currently
 207   * running.
 208   *
 209   * @param  {Object}   hooks          Stored hooks, keyed by hook name.
 210   *
 211   * @return {Function}                Function that returns the current hook.
 212   */
 213  function createCurrentHook(hooks) {
 214    /**
 215     * Returns the name of the currently running hook, or `null` if no hook of
 216     * the given type is currently running.
 217     *
 218     * @return {?string}             The name of the currently running hook, or
 219     *                               `null` if no hook is currently running.
 220     */
 221    return function currentHook() {
 222      if (!hooks.__current || !hooks.__current.length) {
 223        return null;
 224      }
 225  
 226      return hooks.__current[hooks.__current.length - 1].name;
 227    };
 228  }
 229  
 230  /* harmony default export */ __webpack_exports__["default"] = (createCurrentHook);
 231  
 232  
 233  /***/ }),
 234  
 235  /***/ "./node_modules/@wordpress/hooks/build-module/createDidHook.js":
 236  /*!*********************************************************************!*\
 237    !*** ./node_modules/@wordpress/hooks/build-module/createDidHook.js ***!
 238    \*********************************************************************/
 239  /*! exports provided: default */
 240  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 241  
 242  "use strict";
 243  __webpack_require__.r(__webpack_exports__);
 244  /* harmony import */ var _validateHookName_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validateHookName.js */ "./node_modules/@wordpress/hooks/build-module/validateHookName.js");
 245  
 246  /**
 247   * Returns a function which, when invoked, will return the number of times a
 248   * hook has been called.
 249   *
 250   * @param  {Object}   hooks Stored hooks, keyed by hook name.
 251   *
 252   * @return {Function}       Function that returns a hook's call count.
 253   */
 254  
 255  function createDidHook(hooks) {
 256    /**
 257     * Returns the number of times an action has been fired.
 258     *
 259     * @param  {string} hookName The hook name to check.
 260     *
 261     * @return {number}          The number of times the hook has run.
 262     */
 263    return function didHook(hookName) {
 264      if (!Object(_validateHookName_js__WEBPACK_IMPORTED_MODULE_0__["default"])(hookName)) {
 265        return;
 266      }
 267  
 268      return hooks[hookName] && hooks[hookName].runs ? hooks[hookName].runs : 0;
 269    };
 270  }
 271  
 272  /* harmony default export */ __webpack_exports__["default"] = (createDidHook);
 273  
 274  
 275  /***/ }),
 276  
 277  /***/ "./node_modules/@wordpress/hooks/build-module/createDoingHook.js":
 278  /*!***********************************************************************!*\
 279    !*** ./node_modules/@wordpress/hooks/build-module/createDoingHook.js ***!
 280    \***********************************************************************/
 281  /*! exports provided: default */
 282  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 283  
 284  "use strict";
 285  __webpack_require__.r(__webpack_exports__);
 286  /**
 287   * Returns a function which, when invoked, will return whether a hook is
 288   * currently being executed.
 289   *
 290   * @param  {Object}   hooks Stored hooks, keyed by hook name.
 291   *
 292   * @return {Function}       Function that returns whether a hook is currently
 293   *                          being executed.
 294   */
 295  function createDoingHook(hooks) {
 296    /**
 297     * Returns whether a hook is currently being executed.
 298     *
 299     * @param  {?string} hookName The name of the hook to check for.  If
 300     *                            omitted, will check for any hook being executed.
 301     *
 302     * @return {boolean}             Whether the hook is being executed.
 303     */
 304    return function doingHook(hookName) {
 305      // If the hookName was not passed, check for any current hook.
 306      if ('undefined' === typeof hookName) {
 307        return 'undefined' !== typeof hooks.__current[0];
 308      } // Return the __current hook.
 309  
 310  
 311      return hooks.__current[0] ? hookName === hooks.__current[0].name : false;
 312    };
 313  }
 314  
 315  /* harmony default export */ __webpack_exports__["default"] = (createDoingHook);
 316  
 317  
 318  /***/ }),
 319  
 320  /***/ "./node_modules/@wordpress/hooks/build-module/createHasHook.js":
 321  /*!*********************************************************************!*\
 322    !*** ./node_modules/@wordpress/hooks/build-module/createHasHook.js ***!
 323    \*********************************************************************/
 324  /*! exports provided: default */
 325  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 326  
 327  "use strict";
 328  __webpack_require__.r(__webpack_exports__);
 329  /**
 330   * Returns a function which, when invoked, will return whether any handlers are
 331   * attached to a particular hook.
 332   *
 333   * @param  {Object}   hooks Stored hooks, keyed by hook name.
 334   *
 335   * @return {Function}       Function that returns whether any handlers are
 336   *                          attached to a particular hook.
 337   */
 338  function createHasHook(hooks) {
 339    /**
 340     * Returns how many handlers are attached for the given hook.
 341     *
 342     * @param  {string}  hookName The name of the hook to check for.
 343     *
 344     * @return {boolean} Whether there are handlers that are attached to the given hook.
 345     */
 346    return function hasHook(hookName) {
 347      return hookName in hooks;
 348    };
 349  }
 350  
 351  /* harmony default export */ __webpack_exports__["default"] = (createHasHook);
 352  
 353  
 354  /***/ }),
 355  
 356  /***/ "./node_modules/@wordpress/hooks/build-module/createHooks.js":
 357  /*!*******************************************************************!*\
 358    !*** ./node_modules/@wordpress/hooks/build-module/createHooks.js ***!
 359    \*******************************************************************/
 360  /*! exports provided: default */
 361  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 362  
 363  "use strict";
 364  __webpack_require__.r(__webpack_exports__);
 365  /* harmony import */ var _createAddHook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./createAddHook */ "./node_modules/@wordpress/hooks/build-module/createAddHook.js");
 366  /* harmony import */ var _createRemoveHook__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createRemoveHook */ "./node_modules/@wordpress/hooks/build-module/createRemoveHook.js");
 367  /* harmony import */ var _createHasHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createHasHook */ "./node_modules/@wordpress/hooks/build-module/createHasHook.js");
 368  /* harmony import */ var _createRunHook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./createRunHook */ "./node_modules/@wordpress/hooks/build-module/createRunHook.js");
 369  /* harmony import */ var _createCurrentHook__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createCurrentHook */ "./node_modules/@wordpress/hooks/build-module/createCurrentHook.js");
 370  /* harmony import */ var _createDoingHook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./createDoingHook */ "./node_modules/@wordpress/hooks/build-module/createDoingHook.js");
 371  /* harmony import */ var _createDidHook__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./createDidHook */ "./node_modules/@wordpress/hooks/build-module/createDidHook.js");
 372  
 373  
 374  
 375  
 376  
 377  
 378  
 379  /**
 380   * Returns an instance of the hooks object.
 381   *
 382   * @return {Object} Object that contains all hooks.
 383   */
 384  
 385  function createHooks() {
 386    var actions = Object.create(null);
 387    var filters = Object.create(null);
 388    actions.__current = [];
 389    filters.__current = [];
 390    return {
 391      addAction: Object(_createAddHook__WEBPACK_IMPORTED_MODULE_0__["default"])(actions),
 392      addFilter: Object(_createAddHook__WEBPACK_IMPORTED_MODULE_0__["default"])(filters),
 393      removeAction: Object(_createRemoveHook__WEBPACK_IMPORTED_MODULE_1__["default"])(actions),
 394      removeFilter: Object(_createRemoveHook__WEBPACK_IMPORTED_MODULE_1__["default"])(filters),
 395      hasAction: Object(_createHasHook__WEBPACK_IMPORTED_MODULE_2__["default"])(actions),
 396      hasFilter: Object(_createHasHook__WEBPACK_IMPORTED_MODULE_2__["default"])(filters),
 397      removeAllActions: Object(_createRemoveHook__WEBPACK_IMPORTED_MODULE_1__["default"])(actions, true),
 398      removeAllFilters: Object(_createRemoveHook__WEBPACK_IMPORTED_MODULE_1__["default"])(filters, true),
 399      doAction: Object(_createRunHook__WEBPACK_IMPORTED_MODULE_3__["default"])(actions),
 400      applyFilters: Object(_createRunHook__WEBPACK_IMPORTED_MODULE_3__["default"])(filters, true),
 401      currentAction: Object(_createCurrentHook__WEBPACK_IMPORTED_MODULE_4__["default"])(actions),
 402      currentFilter: Object(_createCurrentHook__WEBPACK_IMPORTED_MODULE_4__["default"])(filters),
 403      doingAction: Object(_createDoingHook__WEBPACK_IMPORTED_MODULE_5__["default"])(actions),
 404      doingFilter: Object(_createDoingHook__WEBPACK_IMPORTED_MODULE_5__["default"])(filters),
 405      didAction: Object(_createDidHook__WEBPACK_IMPORTED_MODULE_6__["default"])(actions),
 406      didFilter: Object(_createDidHook__WEBPACK_IMPORTED_MODULE_6__["default"])(filters),
 407      actions: actions,
 408      filters: filters
 409    };
 410  }
 411  
 412  /* harmony default export */ __webpack_exports__["default"] = (createHooks);
 413  
 414  
 415  /***/ }),
 416  
 417  /***/ "./node_modules/@wordpress/hooks/build-module/createRemoveHook.js":
 418  /*!************************************************************************!*\
 419    !*** ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js ***!
 420    \************************************************************************/
 421  /*! exports provided: default */
 422  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 423  
 424  "use strict";
 425  __webpack_require__.r(__webpack_exports__);
 426  /* harmony import */ var _validateNamespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validateNamespace.js */ "./node_modules/@wordpress/hooks/build-module/validateNamespace.js");
 427  /* harmony import */ var _validateHookName_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateHookName.js */ "./node_modules/@wordpress/hooks/build-module/validateHookName.js");
 428  /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ */ "./node_modules/@wordpress/hooks/build-module/index.js");
 429  
 430  
 431  
 432  /**
 433   * Returns a function which, when invoked, will remove a specified hook or all
 434   * hooks by the given name.
 435   *
 436   * @param  {Object}   hooks      Stored hooks, keyed by hook name.
 437   * @param  {boolean}     removeAll  Whether to remove all callbacks for a hookName, without regard to namespace. Used to create `removeAll*` functions.
 438   *
 439   * @return {Function}            Function that removes hooks.
 440   */
 441  
 442  function createRemoveHook(hooks, removeAll) {
 443    /**
 444     * Removes the specified callback (or all callbacks) from the hook with a
 445     * given hookName and namespace.
 446     *
 447     * @param {string}    hookName  The name of the hook to modify.
 448     * @param {string}    namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
 449     *
 450     * @return {number}             The number of callbacks removed.
 451     */
 452    return function removeHook(hookName, namespace) {
 453      if (!Object(_validateHookName_js__WEBPACK_IMPORTED_MODULE_1__["default"])(hookName)) {
 454        return;
 455      }
 456  
 457      if (!removeAll && !Object(_validateNamespace_js__WEBPACK_IMPORTED_MODULE_0__["default"])(namespace)) {
 458        return;
 459      } // Bail if no hooks exist by this name
 460  
 461  
 462      if (!hooks[hookName]) {
 463        return 0;
 464      }
 465  
 466      var handlersRemoved = 0;
 467  
 468      if (removeAll) {
 469        handlersRemoved = hooks[hookName].handlers.length;
 470        hooks[hookName] = {
 471          runs: hooks[hookName].runs,
 472          handlers: []
 473        };
 474      } else {
 475        // Try to find the specified callback to remove.
 476        var handlers = hooks[hookName].handlers;
 477  
 478        var _loop = function _loop(i) {
 479          if (handlers[i].namespace === namespace) {
 480            handlers.splice(i, 1);
 481            handlersRemoved++; // This callback may also be part of a hook that is
 482            // currently executing.  If the callback we're removing
 483            // comes after the current callback, there's no problem;
 484            // otherwise we need to decrease the execution index of any
 485            // other runs by 1 to account for the removed element.
 486  
 487            (hooks.__current || []).forEach(function (hookInfo) {
 488              if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
 489                hookInfo.currentIndex--;
 490              }
 491            });
 492          }
 493        };
 494  
 495        for (var i = handlers.length - 1; i >= 0; i--) {
 496          _loop(i);
 497        }
 498      }
 499  
 500      if (hookName !== 'hookRemoved') {
 501        Object(___WEBPACK_IMPORTED_MODULE_2__["doAction"])('hookRemoved', hookName, namespace);
 502      }
 503  
 504      return handlersRemoved;
 505    };
 506  }
 507  
 508  /* harmony default export */ __webpack_exports__["default"] = (createRemoveHook);
 509  
 510  
 511  /***/ }),
 512  
 513  /***/ "./node_modules/@wordpress/hooks/build-module/createRunHook.js":
 514  /*!*********************************************************************!*\
 515    !*** ./node_modules/@wordpress/hooks/build-module/createRunHook.js ***!
 516    \*********************************************************************/
 517  /*! exports provided: default */
 518  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 519  
 520  "use strict";
 521  __webpack_require__.r(__webpack_exports__);
 522  /**
 523   * Returns a function which, when invoked, will execute all callbacks
 524   * registered to a hook of the specified type, optionally returning the final
 525   * value of the call chain.
 526   *
 527   * @param  {Object}   hooks          Stored hooks, keyed by hook name.
 528   * @param  {?boolean}    returnFirstArg Whether each hook callback is expected to
 529   *                                   return its first argument.
 530   *
 531   * @return {Function}                Function that runs hook callbacks.
 532   */
 533  function createRunHook(hooks, returnFirstArg) {
 534    /**
 535     * Runs all callbacks for the specified hook.
 536     *
 537     * @param  {string} hookName The name of the hook to run.
 538     * @param  {...*}   args     Arguments to pass to the hook callbacks.
 539     *
 540     * @return {*}               Return value of runner, if applicable.
 541     */
 542    return function runHooks(hookName) {
 543      if (!hooks[hookName]) {
 544        hooks[hookName] = {
 545          handlers: [],
 546          runs: 0
 547        };
 548      }
 549  
 550      hooks[hookName].runs++;
 551      var handlers = hooks[hookName].handlers;
 552  
 553      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
 554        args[_key - 1] = arguments[_key];
 555      }
 556  
 557      if (!handlers || !handlers.length) {
 558        return returnFirstArg ? args[0] : undefined;
 559      }
 560  
 561      var hookInfo = {
 562        name: hookName,
 563        currentIndex: 0
 564      };
 565  
 566      hooks.__current.push(hookInfo);
 567  
 568      if (!hooks[hookName]) {
 569        hooks[hookName] = {
 570          runs: 0,
 571          handlers: []
 572        };
 573      }
 574  
 575      while (hookInfo.currentIndex < handlers.length) {
 576        var handler = handlers[hookInfo.currentIndex];
 577        var result = handler.callback.apply(null, args);
 578  
 579        if (returnFirstArg) {
 580          args[0] = result;
 581        }
 582  
 583        hookInfo.currentIndex++;
 584      }
 585  
 586      hooks.__current.pop();
 587  
 588      if (returnFirstArg) {
 589        return args[0];
 590      }
 591    };
 592  }
 593  
 594  /* harmony default export */ __webpack_exports__["default"] = (createRunHook);
 595  
 596  
 597  /***/ }),
 598  
 599  /***/ "./node_modules/@wordpress/hooks/build-module/index.js":
 600  /*!*************************************************************!*\
 601    !*** ./node_modules/@wordpress/hooks/build-module/index.js ***!
 602    \*************************************************************/
 603  /*! exports provided: createHooks, addAction, addFilter, removeAction, removeFilter, hasAction, hasFilter, removeAllActions, removeAllFilters, doAction, applyFilters, currentAction, currentFilter, doingAction, doingFilter, didAction, didFilter, actions, filters */
 604  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 605  
 606  "use strict";
 607  __webpack_require__.r(__webpack_exports__);
 608  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAction", function() { return addAction; });
 609  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFilter", function() { return addFilter; });
 610  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAction", function() { return removeAction; });
 611  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return removeFilter; });
 612  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAction", function() { return hasAction; });
 613  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return hasFilter; });
 614  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return removeAllActions; });
 615  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return removeAllFilters; });
 616  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doAction", function() { return doAction; });
 617  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return applyFilters; });
 618  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentAction", function() { return currentAction; });
 619  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return currentFilter; });
 620  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingAction", function() { return doingAction; });
 621  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return doingFilter; });
 622  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didAction", function() { return didAction; });
 623  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didFilter", function() { return didFilter; });
 624  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "actions", function() { return actions; });
 625  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filters", function() { return filters; });
 626  /* harmony import */ var _createHooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./createHooks */ "./node_modules/@wordpress/hooks/build-module/createHooks.js");
 627  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createHooks", function() { return _createHooks__WEBPACK_IMPORTED_MODULE_0__["default"]; });
 628  
 629  
 630  
 631  var _createHooks = Object(_createHooks__WEBPACK_IMPORTED_MODULE_0__["default"])(),
 632      addAction = _createHooks.addAction,
 633      addFilter = _createHooks.addFilter,
 634      removeAction = _createHooks.removeAction,
 635      removeFilter = _createHooks.removeFilter,
 636      hasAction = _createHooks.hasAction,
 637      hasFilter = _createHooks.hasFilter,
 638      removeAllActions = _createHooks.removeAllActions,
 639      removeAllFilters = _createHooks.removeAllFilters,
 640      doAction = _createHooks.doAction,
 641      applyFilters = _createHooks.applyFilters,
 642      currentAction = _createHooks.currentAction,
 643      currentFilter = _createHooks.currentFilter,
 644      doingAction = _createHooks.doingAction,
 645      doingFilter = _createHooks.doingFilter,
 646      didAction = _createHooks.didAction,
 647      didFilter = _createHooks.didFilter,
 648      actions = _createHooks.actions,
 649      filters = _createHooks.filters;
 650  
 651  
 652  
 653  
 654  /***/ }),
 655  
 656  /***/ "./node_modules/@wordpress/hooks/build-module/validateHookName.js":
 657  /*!************************************************************************!*\
 658    !*** ./node_modules/@wordpress/hooks/build-module/validateHookName.js ***!
 659    \************************************************************************/
 660  /*! exports provided: default */
 661  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 662  
 663  "use strict";
 664  __webpack_require__.r(__webpack_exports__);
 665  /**
 666   * Validate a hookName string.
 667   *
 668   * @param  {string} hookName The hook name to validate. Should be a non empty string containing
 669   *                           only numbers, letters, dashes, periods and underscores. Also,
 670   *                           the hook name cannot begin with `__`.
 671   *
 672   * @return {boolean}            Whether the hook name is valid.
 673   */
 674  function validateHookName(hookName) {
 675    if ('string' !== typeof hookName || '' === hookName) {
 676      // eslint-disable-next-line no-console
 677      console.error('The hook name must be a non-empty string.');
 678      return false;
 679    }
 680  
 681    if (/^__/.test(hookName)) {
 682      // eslint-disable-next-line no-console
 683      console.error('The hook name cannot begin with `__`.');
 684      return false;
 685    }
 686  
 687    if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
 688      // eslint-disable-next-line no-console
 689      console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.');
 690      return false;
 691    }
 692  
 693    return true;
 694  }
 695  
 696  /* harmony default export */ __webpack_exports__["default"] = (validateHookName);
 697  
 698  
 699  /***/ }),
 700  
 701  /***/ "./node_modules/@wordpress/hooks/build-module/validateNamespace.js":
 702  /*!*************************************************************************!*\
 703    !*** ./node_modules/@wordpress/hooks/build-module/validateNamespace.js ***!
 704    \*************************************************************************/
 705  /*! exports provided: default */
 706  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 707  
 708  "use strict";
 709  __webpack_require__.r(__webpack_exports__);
 710  /**
 711   * Validate a namespace string.
 712   *
 713   * @param  {string} namespace The namespace to validate - should take the form
 714   *                            `vendor/plugin/function`.
 715   *
 716   * @return {boolean}             Whether the namespace is valid.
 717   */
 718  function validateNamespace(namespace) {
 719    if ('string' !== typeof namespace || '' === namespace) {
 720      // eslint-disable-next-line no-console
 721      console.error('The namespace must be a non-empty string.');
 722      return false;
 723    }
 724  
 725    if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
 726      // eslint-disable-next-line no-console
 727      console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.');
 728      return false;
 729    }
 730  
 731    return true;
 732  }
 733  
 734  /* harmony default export */ __webpack_exports__["default"] = (validateNamespace);
 735  
 736  
 737  /***/ })
 738  
 739  /******/ });
 740  //# sourceMappingURL=hooks.js.map


Generated: Mon Jan 7 01:00:05 2019 Cross-referenced by PHPXref 0.7.1