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>
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
'use strict';
|
|
var getBuiltIn = require('../internals/get-built-in');
|
|
|
|
var createSetLike = function (size) {
|
|
return {
|
|
size: size,
|
|
has: function () {
|
|
return false;
|
|
},
|
|
keys: function () {
|
|
return {
|
|
next: function () {
|
|
return { done: true };
|
|
}
|
|
};
|
|
}
|
|
};
|
|
};
|
|
|
|
var createSetLikeWithInfinitySize = function (size) {
|
|
return {
|
|
size: size,
|
|
has: function () {
|
|
return true;
|
|
},
|
|
keys: function () {
|
|
throw new Error('e');
|
|
}
|
|
};
|
|
};
|
|
|
|
module.exports = function (name, callback) {
|
|
var Set = getBuiltIn('Set');
|
|
try {
|
|
new Set()[name](createSetLike(0));
|
|
try {
|
|
// late spec change, early WebKit ~ Safari 17 implementation does not pass it
|
|
// https://github.com/tc39/proposal-set-methods/pull/88
|
|
// also covered engines with
|
|
// https://bugs.webkit.org/show_bug.cgi?id=272679
|
|
new Set()[name](createSetLike(-1));
|
|
return false;
|
|
} catch (error2) {
|
|
if (!callback) return true;
|
|
// early V8 implementation bug
|
|
// https://issues.chromium.org/issues/351332634
|
|
try {
|
|
new Set()[name](createSetLikeWithInfinitySize(-Infinity));
|
|
return false;
|
|
} catch (error) {
|
|
var set = new Set([1, 2]);
|
|
return callback(set[name](createSetLikeWithInfinitySize(Infinity)));
|
|
}
|
|
}
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
};
|