Edit File by line
/home/barbar84/public_h.../wp-inclu.../js/dist
File: hooks.js
this["wp"] = this["wp"] || {}; this["wp"]["hooks"] =
[0] Fix | Delete
/******/ (function(modules) { // webpackBootstrap
[1] Fix | Delete
/******/ // The module cache
[2] Fix | Delete
/******/ var installedModules = {};
[3] Fix | Delete
/******/
[4] Fix | Delete
/******/ // The require function
[5] Fix | Delete
/******/ function __webpack_require__(moduleId) {
[6] Fix | Delete
/******/
[7] Fix | Delete
/******/ // Check if module is in cache
[8] Fix | Delete
/******/ if(installedModules[moduleId]) {
[9] Fix | Delete
/******/ return installedModules[moduleId].exports;
[10] Fix | Delete
/******/ }
[11] Fix | Delete
/******/ // Create a new module (and put it into the cache)
[12] Fix | Delete
/******/ var module = installedModules[moduleId] = {
[13] Fix | Delete
/******/ i: moduleId,
[14] Fix | Delete
/******/ l: false,
[15] Fix | Delete
/******/ exports: {}
[16] Fix | Delete
/******/ };
[17] Fix | Delete
/******/
[18] Fix | Delete
/******/ // Execute the module function
[19] Fix | Delete
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
[20] Fix | Delete
/******/
[21] Fix | Delete
/******/ // Flag the module as loaded
[22] Fix | Delete
/******/ module.l = true;
[23] Fix | Delete
/******/
[24] Fix | Delete
/******/ // Return the exports of the module
[25] Fix | Delete
/******/ return module.exports;
[26] Fix | Delete
/******/ }
[27] Fix | Delete
/******/
[28] Fix | Delete
/******/
[29] Fix | Delete
/******/ // expose the modules object (__webpack_modules__)
[30] Fix | Delete
/******/ __webpack_require__.m = modules;
[31] Fix | Delete
/******/
[32] Fix | Delete
/******/ // expose the module cache
[33] Fix | Delete
/******/ __webpack_require__.c = installedModules;
[34] Fix | Delete
/******/
[35] Fix | Delete
/******/ // define getter function for harmony exports
[36] Fix | Delete
/******/ __webpack_require__.d = function(exports, name, getter) {
[37] Fix | Delete
/******/ if(!__webpack_require__.o(exports, name)) {
[38] Fix | Delete
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
[39] Fix | Delete
/******/ }
[40] Fix | Delete
/******/ };
[41] Fix | Delete
/******/
[42] Fix | Delete
/******/ // define __esModule on exports
[43] Fix | Delete
/******/ __webpack_require__.r = function(exports) {
[44] Fix | Delete
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
[45] Fix | Delete
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
[46] Fix | Delete
/******/ }
[47] Fix | Delete
/******/ Object.defineProperty(exports, '__esModule', { value: true });
[48] Fix | Delete
/******/ };
[49] Fix | Delete
/******/
[50] Fix | Delete
/******/ // create a fake namespace object
[51] Fix | Delete
/******/ // mode & 1: value is a module id, require it
[52] Fix | Delete
/******/ // mode & 2: merge all properties of value into the ns
[53] Fix | Delete
/******/ // mode & 4: return value when already ns object
[54] Fix | Delete
/******/ // mode & 8|1: behave like require
[55] Fix | Delete
/******/ __webpack_require__.t = function(value, mode) {
[56] Fix | Delete
/******/ if(mode & 1) value = __webpack_require__(value);
[57] Fix | Delete
/******/ if(mode & 8) return value;
[58] Fix | Delete
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
[59] Fix | Delete
/******/ var ns = Object.create(null);
[60] Fix | Delete
/******/ __webpack_require__.r(ns);
[61] Fix | Delete
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
[62] Fix | Delete
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
[63] Fix | Delete
/******/ return ns;
[64] Fix | Delete
/******/ };
[65] Fix | Delete
/******/
[66] Fix | Delete
/******/ // getDefaultExport function for compatibility with non-harmony modules
[67] Fix | Delete
/******/ __webpack_require__.n = function(module) {
[68] Fix | Delete
/******/ var getter = module && module.__esModule ?
[69] Fix | Delete
/******/ function getDefault() { return module['default']; } :
[70] Fix | Delete
/******/ function getModuleExports() { return module; };
[71] Fix | Delete
/******/ __webpack_require__.d(getter, 'a', getter);
[72] Fix | Delete
/******/ return getter;
[73] Fix | Delete
/******/ };
[74] Fix | Delete
/******/
[75] Fix | Delete
/******/ // Object.prototype.hasOwnProperty.call
[76] Fix | Delete
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
[77] Fix | Delete
/******/
[78] Fix | Delete
/******/ // __webpack_public_path__
[79] Fix | Delete
/******/ __webpack_require__.p = "";
[80] Fix | Delete
/******/
[81] Fix | Delete
/******/
[82] Fix | Delete
/******/ // Load entry module and return exports
[83] Fix | Delete
/******/ return __webpack_require__(__webpack_require__.s = "gEOj");
[84] Fix | Delete
/******/ })
[85] Fix | Delete
/************************************************************************/
[86] Fix | Delete
/******/ ({
[87] Fix | Delete
[88] Fix | Delete
/***/ "1OyB":
[89] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[90] Fix | Delete
[91] Fix | Delete
"use strict";
[92] Fix | Delete
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
[93] Fix | Delete
function _classCallCheck(instance, Constructor) {
[94] Fix | Delete
if (!(instance instanceof Constructor)) {
[95] Fix | Delete
throw new TypeError("Cannot call a class as a function");
[96] Fix | Delete
}
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
/***/ }),
[100] Fix | Delete
[101] Fix | Delete
/***/ "25BE":
[102] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[103] Fix | Delete
[104] Fix | Delete
"use strict";
[105] Fix | Delete
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
[106] Fix | Delete
function _iterableToArray(iter) {
[107] Fix | Delete
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
/***/ }),
[111] Fix | Delete
[112] Fix | Delete
/***/ "BsWD":
[113] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[114] Fix | Delete
[115] Fix | Delete
"use strict";
[116] Fix | Delete
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
[117] Fix | Delete
/* harmony import */ var _babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a3WO");
[118] Fix | Delete
[119] Fix | Delete
function _unsupportedIterableToArray(o, minLen) {
[120] Fix | Delete
if (!o) return;
[121] Fix | Delete
if (typeof o === "string") return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
[122] Fix | Delete
var n = Object.prototype.toString.call(o).slice(8, -1);
[123] Fix | Delete
if (n === "Object" && o.constructor) n = o.constructor.name;
[124] Fix | Delete
if (n === "Map" || n === "Set") return Array.from(o);
[125] Fix | Delete
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
/***/ }),
[129] Fix | Delete
[130] Fix | Delete
/***/ "KQm4":
[131] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[132] Fix | Delete
[133] Fix | Delete
"use strict";
[134] Fix | Delete
[135] Fix | Delete
// EXPORTS
[136] Fix | Delete
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
[137] Fix | Delete
[138] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
[139] Fix | Delete
var arrayLikeToArray = __webpack_require__("a3WO");
[140] Fix | Delete
[141] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
[142] Fix | Delete
[143] Fix | Delete
function _arrayWithoutHoles(arr) {
[144] Fix | Delete
if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
[145] Fix | Delete
}
[146] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
[147] Fix | Delete
var iterableToArray = __webpack_require__("25BE");
[148] Fix | Delete
[149] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
[150] Fix | Delete
var unsupportedIterableToArray = __webpack_require__("BsWD");
[151] Fix | Delete
[152] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
[153] Fix | Delete
function _nonIterableSpread() {
[154] Fix | Delete
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
[155] Fix | Delete
}
[156] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
[157] Fix | Delete
[158] Fix | Delete
[159] Fix | Delete
[160] Fix | Delete
[161] Fix | Delete
function _toConsumableArray(arr) {
[162] Fix | Delete
return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
[163] Fix | Delete
}
[164] Fix | Delete
[165] Fix | Delete
/***/ }),
[166] Fix | Delete
[167] Fix | Delete
/***/ "a3WO":
[168] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[169] Fix | Delete
[170] Fix | Delete
"use strict";
[171] Fix | Delete
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
[172] Fix | Delete
function _arrayLikeToArray(arr, len) {
[173] Fix | Delete
if (len == null || len > arr.length) len = arr.length;
[174] Fix | Delete
[175] Fix | Delete
for (var i = 0, arr2 = new Array(len); i < len; i++) {
[176] Fix | Delete
arr2[i] = arr[i];
[177] Fix | Delete
}
[178] Fix | Delete
[179] Fix | Delete
return arr2;
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
/***/ }),
[183] Fix | Delete
[184] Fix | Delete
/***/ "gEOj":
[185] Fix | Delete
/***/ (function(module, __webpack_exports__, __webpack_require__) {
[186] Fix | Delete
[187] Fix | Delete
"use strict";
[188] Fix | Delete
// ESM COMPAT FLAG
[189] Fix | Delete
__webpack_require__.r(__webpack_exports__);
[190] Fix | Delete
[191] Fix | Delete
// EXPORTS
[192] Fix | Delete
__webpack_require__.d(__webpack_exports__, "createHooks", function() { return /* reexport */ build_module_createHooks; });
[193] Fix | Delete
__webpack_require__.d(__webpack_exports__, "addAction", function() { return /* binding */ addAction; });
[194] Fix | Delete
__webpack_require__.d(__webpack_exports__, "addFilter", function() { return /* binding */ addFilter; });
[195] Fix | Delete
__webpack_require__.d(__webpack_exports__, "removeAction", function() { return /* binding */ removeAction; });
[196] Fix | Delete
__webpack_require__.d(__webpack_exports__, "removeFilter", function() { return /* binding */ removeFilter; });
[197] Fix | Delete
__webpack_require__.d(__webpack_exports__, "hasAction", function() { return /* binding */ hasAction; });
[198] Fix | Delete
__webpack_require__.d(__webpack_exports__, "hasFilter", function() { return /* binding */ hasFilter; });
[199] Fix | Delete
__webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return /* binding */ removeAllActions; });
[200] Fix | Delete
__webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return /* binding */ removeAllFilters; });
[201] Fix | Delete
__webpack_require__.d(__webpack_exports__, "doAction", function() { return /* binding */ doAction; });
[202] Fix | Delete
__webpack_require__.d(__webpack_exports__, "applyFilters", function() { return /* binding */ applyFilters; });
[203] Fix | Delete
__webpack_require__.d(__webpack_exports__, "currentAction", function() { return /* binding */ currentAction; });
[204] Fix | Delete
__webpack_require__.d(__webpack_exports__, "currentFilter", function() { return /* binding */ currentFilter; });
[205] Fix | Delete
__webpack_require__.d(__webpack_exports__, "doingAction", function() { return /* binding */ doingAction; });
[206] Fix | Delete
__webpack_require__.d(__webpack_exports__, "doingFilter", function() { return /* binding */ doingFilter; });
[207] Fix | Delete
__webpack_require__.d(__webpack_exports__, "didAction", function() { return /* binding */ didAction; });
[208] Fix | Delete
__webpack_require__.d(__webpack_exports__, "didFilter", function() { return /* binding */ didFilter; });
[209] Fix | Delete
__webpack_require__.d(__webpack_exports__, "actions", function() { return /* binding */ actions; });
[210] Fix | Delete
__webpack_require__.d(__webpack_exports__, "filters", function() { return /* binding */ filters; });
[211] Fix | Delete
[212] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
[213] Fix | Delete
var classCallCheck = __webpack_require__("1OyB");
[214] Fix | Delete
[215] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js
[216] Fix | Delete
/**
[217] Fix | Delete
* Validate a namespace string.
[218] Fix | Delete
*
[219] Fix | Delete
* @param {string} namespace The namespace to validate - should take the form
[220] Fix | Delete
* `vendor/plugin/function`.
[221] Fix | Delete
*
[222] Fix | Delete
* @return {boolean} Whether the namespace is valid.
[223] Fix | Delete
*/
[224] Fix | Delete
function validateNamespace(namespace) {
[225] Fix | Delete
if ('string' !== typeof namespace || '' === namespace) {
[226] Fix | Delete
// eslint-disable-next-line no-console
[227] Fix | Delete
console.error('The namespace must be a non-empty string.');
[228] Fix | Delete
return false;
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
[232] Fix | Delete
// eslint-disable-next-line no-console
[233] Fix | Delete
console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.');
[234] Fix | Delete
return false;
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
return true;
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
/* harmony default export */ var build_module_validateNamespace = (validateNamespace);
[241] Fix | Delete
[242] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js
[243] Fix | Delete
/**
[244] Fix | Delete
* Validate a hookName string.
[245] Fix | Delete
*
[246] Fix | Delete
* @param {string} hookName The hook name to validate. Should be a non empty string containing
[247] Fix | Delete
* only numbers, letters, dashes, periods and underscores. Also,
[248] Fix | Delete
* the hook name cannot begin with `__`.
[249] Fix | Delete
*
[250] Fix | Delete
* @return {boolean} Whether the hook name is valid.
[251] Fix | Delete
*/
[252] Fix | Delete
function validateHookName(hookName) {
[253] Fix | Delete
if ('string' !== typeof hookName || '' === hookName) {
[254] Fix | Delete
// eslint-disable-next-line no-console
[255] Fix | Delete
console.error('The hook name must be a non-empty string.');
[256] Fix | Delete
return false;
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
if (/^__/.test(hookName)) {
[260] Fix | Delete
// eslint-disable-next-line no-console
[261] Fix | Delete
console.error('The hook name cannot begin with `__`.');
[262] Fix | Delete
return false;
[263] Fix | Delete
}
[264] Fix | Delete
[265] Fix | Delete
if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
[266] Fix | Delete
// eslint-disable-next-line no-console
[267] Fix | Delete
console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.');
[268] Fix | Delete
return false;
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
return true;
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
/* harmony default export */ var build_module_validateHookName = (validateHookName);
[275] Fix | Delete
[276] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js
[277] Fix | Delete
/**
[278] Fix | Delete
* Internal dependencies
[279] Fix | Delete
*/
[280] Fix | Delete
[281] Fix | Delete
[282] Fix | Delete
/**
[283] Fix | Delete
* @callback AddHook
[284] Fix | Delete
*
[285] Fix | Delete
* Adds the hook to the appropriate hooks container.
[286] Fix | Delete
*
[287] Fix | Delete
* @param {string} hookName Name of hook to add
[288] Fix | Delete
* @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
[289] Fix | Delete
* @param {import('.').Callback} callback Function to call when the hook is run
[290] Fix | Delete
* @param {number} [priority=10] Priority of this hook
[291] Fix | Delete
*/
[292] Fix | Delete
[293] Fix | Delete
/**
[294] Fix | Delete
* Returns a function which, when invoked, will add a hook.
[295] Fix | Delete
*
[296] Fix | Delete
* @param {import('.').Hooks} hooks Hooks instance.
[297] Fix | Delete
* @param {import('.').StoreKey} storeKey
[298] Fix | Delete
*
[299] Fix | Delete
* @return {AddHook} Function that adds a new hook.
[300] Fix | Delete
*/
[301] Fix | Delete
[302] Fix | Delete
function createAddHook(hooks, storeKey) {
[303] Fix | Delete
return function addHook(hookName, namespace, callback) {
[304] Fix | Delete
var priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
[305] Fix | Delete
var hooksStore = hooks[storeKey];
[306] Fix | Delete
[307] Fix | Delete
if (!build_module_validateHookName(hookName)) {
[308] Fix | Delete
return;
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
if (!build_module_validateNamespace(namespace)) {
[312] Fix | Delete
return;
[313] Fix | Delete
}
[314] Fix | Delete
[315] Fix | Delete
if ('function' !== typeof callback) {
[316] Fix | Delete
// eslint-disable-next-line no-console
[317] Fix | Delete
console.error('The hook callback must be a function.');
[318] Fix | Delete
return;
[319] Fix | Delete
} // Validate numeric priority
[320] Fix | Delete
[321] Fix | Delete
[322] Fix | Delete
if ('number' !== typeof priority) {
[323] Fix | Delete
// eslint-disable-next-line no-console
[324] Fix | Delete
console.error('If specified, the hook priority must be a number.');
[325] Fix | Delete
return;
[326] Fix | Delete
}
[327] Fix | Delete
[328] Fix | Delete
var handler = {
[329] Fix | Delete
callback: callback,
[330] Fix | Delete
priority: priority,
[331] Fix | Delete
namespace: namespace
[332] Fix | Delete
};
[333] Fix | Delete
[334] Fix | Delete
if (hooksStore[hookName]) {
[335] Fix | Delete
// Find the correct insert index of the new hook.
[336] Fix | Delete
var handlers = hooksStore[hookName].handlers;
[337] Fix | Delete
/** @type {number} */
[338] Fix | Delete
[339] Fix | Delete
var i;
[340] Fix | Delete
[341] Fix | Delete
for (i = handlers.length; i > 0; i--) {
[342] Fix | Delete
if (priority >= handlers[i - 1].priority) {
[343] Fix | Delete
break;
[344] Fix | Delete
}
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
if (i === handlers.length) {
[348] Fix | Delete
// If append, operate via direct assignment.
[349] Fix | Delete
handlers[i] = handler;
[350] Fix | Delete
} else {
[351] Fix | Delete
// Otherwise, insert before index via splice.
[352] Fix | Delete
handlers.splice(i, 0, handler);
[353] Fix | Delete
} // We may also be currently executing this hook. If the callback
[354] Fix | Delete
// we're adding would come after the current callback, there's no
[355] Fix | Delete
// problem; otherwise we need to increase the execution index of
[356] Fix | Delete
// any other runs by 1 to account for the added element.
[357] Fix | Delete
[358] Fix | Delete
[359] Fix | Delete
hooksStore.__current.forEach(function (hookInfo) {
[360] Fix | Delete
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
[361] Fix | Delete
hookInfo.currentIndex++;
[362] Fix | Delete
}
[363] Fix | Delete
});
[364] Fix | Delete
} else {
[365] Fix | Delete
// This is the first hook of its type.
[366] Fix | Delete
hooksStore[hookName] = {
[367] Fix | Delete
handlers: [handler],
[368] Fix | Delete
runs: 0
[369] Fix | Delete
};
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
if (hookName !== 'hookAdded') {
[373] Fix | Delete
hooks.doAction('hookAdded', hookName, namespace, callback, priority);
[374] Fix | Delete
}
[375] Fix | Delete
};
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
/* harmony default export */ var build_module_createAddHook = (createAddHook);
[379] Fix | Delete
[380] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js
[381] Fix | Delete
/**
[382] Fix | Delete
* Internal dependencies
[383] Fix | Delete
*/
[384] Fix | Delete
[385] Fix | Delete
[386] Fix | Delete
/**
[387] Fix | Delete
* @callback RemoveHook
[388] Fix | Delete
* Removes the specified callback (or all callbacks) from the hook with a given hookName
[389] Fix | Delete
* and namespace.
[390] Fix | Delete
*
[391] Fix | Delete
* @param {string} hookName The name of the hook to modify.
[392] Fix | Delete
* @param {string} namespace The unique namespace identifying the callback in the
[393] Fix | Delete
* form `vendor/plugin/function`.
[394] Fix | Delete
*
[395] Fix | Delete
* @return {number | undefined} The number of callbacks removed.
[396] Fix | Delete
*/
[397] Fix | Delete
[398] Fix | Delete
/**
[399] Fix | Delete
* Returns a function which, when invoked, will remove a specified hook or all
[400] Fix | Delete
* hooks by the given name.
[401] Fix | Delete
*
[402] Fix | Delete
* @param {import('.').Hooks} hooks Hooks instance.
[403] Fix | Delete
* @param {import('.').StoreKey} storeKey
[404] Fix | Delete
* @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,
[405] Fix | Delete
* without regard to namespace. Used to create
[406] Fix | Delete
* `removeAll*` functions.
[407] Fix | Delete
*
[408] Fix | Delete
* @return {RemoveHook} Function that removes hooks.
[409] Fix | Delete
*/
[410] Fix | Delete
[411] Fix | Delete
function createRemoveHook(hooks, storeKey) {
[412] Fix | Delete
var removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
[413] Fix | Delete
return function removeHook(hookName, namespace) {
[414] Fix | Delete
var hooksStore = hooks[storeKey];
[415] Fix | Delete
[416] Fix | Delete
if (!build_module_validateHookName(hookName)) {
[417] Fix | Delete
return;
[418] Fix | Delete
}
[419] Fix | Delete
[420] Fix | Delete
if (!removeAll && !build_module_validateNamespace(namespace)) {
[421] Fix | Delete
return;
[422] Fix | Delete
} // Bail if no hooks exist by this name
[423] Fix | Delete
[424] Fix | Delete
[425] Fix | Delete
if (!hooksStore[hookName]) {
[426] Fix | Delete
return 0;
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
var handlersRemoved = 0;
[430] Fix | Delete
[431] Fix | Delete
if (removeAll) {
[432] Fix | Delete
handlersRemoved = hooksStore[hookName].handlers.length;
[433] Fix | Delete
hooksStore[hookName] = {
[434] Fix | Delete
runs: hooksStore[hookName].runs,
[435] Fix | Delete
handlers: []
[436] Fix | Delete
};
[437] Fix | Delete
} else {
[438] Fix | Delete
// Try to find the specified callback to remove.
[439] Fix | Delete
var handlers = hooksStore[hookName].handlers;
[440] Fix | Delete
[441] Fix | Delete
var _loop = function _loop(i) {
[442] Fix | Delete
if (handlers[i].namespace === namespace) {
[443] Fix | Delete
handlers.splice(i, 1);
[444] Fix | Delete
handlersRemoved++; // This callback may also be part of a hook that is
[445] Fix | Delete
// currently executing. If the callback we're removing
[446] Fix | Delete
// comes after the current callback, there's no problem;
[447] Fix | Delete
// otherwise we need to decrease the execution index of any
[448] Fix | Delete
// other runs by 1 to account for the removed element.
[449] Fix | Delete
[450] Fix | Delete
hooksStore.__current.forEach(function (hookInfo) {
[451] Fix | Delete
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
[452] Fix | Delete
hookInfo.currentIndex--;
[453] Fix | Delete
}
[454] Fix | Delete
});
[455] Fix | Delete
}
[456] Fix | Delete
};
[457] Fix | Delete
[458] Fix | Delete
for (var i = handlers.length - 1; i >= 0; i--) {
[459] Fix | Delete
_loop(i);
[460] Fix | Delete
}
[461] Fix | Delete
}
[462] Fix | Delete
[463] Fix | Delete
if (hookName !== 'hookRemoved') {
[464] Fix | Delete
hooks.doAction('hookRemoved', hookName, namespace);
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
return handlersRemoved;
[468] Fix | Delete
};
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
/* harmony default export */ var build_module_createRemoveHook = (createRemoveHook);
[472] Fix | Delete
[473] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js
[474] Fix | Delete
/**
[475] Fix | Delete
* @callback HasHook
[476] Fix | Delete
*
[477] Fix | Delete
* Returns whether any handlers are attached for the given hookName and optional namespace.
[478] Fix | Delete
*
[479] Fix | Delete
* @param {string} hookName The name of the hook to check for.
[480] Fix | Delete
* @param {string} [namespace] Optional. The unique namespace identifying the callback
[481] Fix | Delete
* in the form `vendor/plugin/function`.
[482] Fix | Delete
*
[483] Fix | Delete
* @return {boolean} Whether there are handlers that are attached to the given hook.
[484] Fix | Delete
*/
[485] Fix | Delete
[486] Fix | Delete
/**
[487] Fix | Delete
* Returns a function which, when invoked, will return whether any handlers are
[488] Fix | Delete
* attached to a particular hook.
[489] Fix | Delete
*
[490] Fix | Delete
* @param {import('.').Hooks} hooks Hooks instance.
[491] Fix | Delete
* @param {import('.').StoreKey} storeKey
[492] Fix | Delete
*
[493] Fix | Delete
* @return {HasHook} Function that returns whether any handlers are
[494] Fix | Delete
* attached to a particular hook and optional namespace.
[495] Fix | Delete
*/
[496] Fix | Delete
function createHasHook(hooks, storeKey) {
[497] Fix | Delete
return function hasHook(hookName, namespace) {
[498] Fix | Delete
var hooksStore = hooks[storeKey]; // Use the namespace if provided.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function