@wordpress/hooks
Advanced tools
Comparing version 3.34.0 to 3.35.0
@@ -27,4 +27,3 @@ /** | ||
function createAddHook(hooks, storeKey) { | ||
return function addHook(hookName, namespace, callback) { | ||
let priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10; | ||
return function addHook(hookName, namespace, callback, priority = 10) { | ||
const hooksStore = hooks[storeKey]; | ||
@@ -31,0 +30,0 @@ |
@@ -13,6 +13,6 @@ /** | ||
return function currentHook() { | ||
var _hooksStore$__current, _hooksStore$__current2; | ||
var _hooksStore$__current; | ||
const hooksStore = hooks[storeKey]; | ||
return (_hooksStore$__current = (_hooksStore$__current2 = hooksStore.__current[hooksStore.__current.length - 1]) === null || _hooksStore$__current2 === void 0 ? void 0 : _hooksStore$__current2.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null; | ||
return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null; | ||
}; | ||
@@ -19,0 +19,0 @@ } |
@@ -31,4 +31,3 @@ /** | ||
function createRemoveHook(hooks, storeKey) { | ||
let removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
function createRemoveHook(hooks, storeKey, removeAll = false) { | ||
return function removeHook(hookName, namespace) { | ||
@@ -35,0 +34,0 @@ const hooksStore = hooks[storeKey]; |
@@ -13,5 +13,4 @@ /** | ||
*/ | ||
function createRunHook(hooks, storeKey) { | ||
let returnFirstArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
return function runHooks(hookName) { | ||
function createRunHook(hooks, storeKey, returnFirstArg = false) { | ||
return function runHooks(hookName, ...args) { | ||
const hooksStore = hooks[storeKey]; | ||
@@ -36,6 +35,2 @@ | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
if (!handlers || !handlers.length) { | ||
@@ -42,0 +37,0 @@ return returnFirstArg ? args[0] : undefined; |
@@ -38,4 +38,3 @@ "use strict"; | ||
function createAddHook(hooks, storeKey) { | ||
return function addHook(hookName, namespace, callback) { | ||
let priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10; | ||
return function addHook(hookName, namespace, callback, priority = 10) { | ||
const hooksStore = hooks[storeKey]; | ||
@@ -42,0 +41,0 @@ |
@@ -20,6 +20,6 @@ "use strict"; | ||
return function currentHook() { | ||
var _hooksStore$__current, _hooksStore$__current2; | ||
var _hooksStore$__current; | ||
const hooksStore = hooks[storeKey]; | ||
return (_hooksStore$__current = (_hooksStore$__current2 = hooksStore.__current[hooksStore.__current.length - 1]) === null || _hooksStore$__current2 === void 0 ? void 0 : _hooksStore$__current2.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null; | ||
return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null; | ||
}; | ||
@@ -26,0 +26,0 @@ } |
@@ -42,4 +42,3 @@ "use strict"; | ||
*/ | ||
function createRemoveHook(hooks, storeKey) { | ||
let removeAll = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
function createRemoveHook(hooks, storeKey, removeAll = false) { | ||
return function removeHook(hookName, namespace) { | ||
@@ -46,0 +45,0 @@ const hooksStore = hooks[storeKey]; |
@@ -20,5 +20,4 @@ "use strict"; | ||
*/ | ||
function createRunHook(hooks, storeKey) { | ||
let returnFirstArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
return function runHooks(hookName) { | ||
function createRunHook(hooks, storeKey, returnFirstArg = false) { | ||
return function runHooks(hookName, ...args) { | ||
const hooksStore = hooks[storeKey]; | ||
@@ -43,6 +42,2 @@ | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
if (!handlers || !handlers.length) { | ||
@@ -49,0 +44,0 @@ return returnFirstArg ? args[0] : undefined; |
@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
## 3.35.0 (2023-06-07) | ||
## 3.34.0 (2023-05-24) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@wordpress/hooks", | ||
"version": "3.34.0", | ||
"version": "3.35.0", | ||
"description": "WordPress hooks library.", | ||
@@ -34,3 +34,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19" | ||
"gitHead": "a92f606309b1541b834ff9b0a76ed2a466fc45ed" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
213335
2710