Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
/**
|
|
* @callback HasHook
|
|
*
|
|
* Returns whether any handlers are attached for the given hookName and optional namespace.
|
|
*
|
|
* @param {string} hookName The name of the hook to check for.
|
|
* @param {string} [namespace] Optional. The unique namespace identifying the callback
|
|
* in the form `vendor/plugin/function`.
|
|
*
|
|
* @return {boolean} Whether there are handlers that are attached to the given hook.
|
|
*/
|
|
/**
|
|
* Returns a function which, when invoked, will return whether any handlers are
|
|
* attached to a particular hook.
|
|
*
|
|
* @param {import('.').Hooks} hooks Hooks instance.
|
|
* @param {import('.').StoreKey} storeKey
|
|
*
|
|
* @return {HasHook} Function that returns whether any handlers are
|
|
* attached to a particular hook and optional namespace.
|
|
*/
|
|
function createHasHook(hooks, storeKey) {
|
|
return function hasHook(hookName, namespace) {
|
|
const hooksStore = hooks[storeKey];
|
|
|
|
// Use the namespace if provided.
|
|
if ('undefined' !== typeof namespace) {
|
|
return hookName in hooksStore && hooksStore[hookName].handlers.some(hook => hook.namespace === namespace);
|
|
}
|
|
return hookName in hooksStore;
|
|
};
|
|
}
|
|
var _default = exports.default = createHasHook;
|
|
//# sourceMappingURL=createHasHook.js.map
|