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>
46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
'use strict';
|
|
var $ = require('../internals/export');
|
|
var toObject = require('../internals/to-object');
|
|
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
|
var setArrayLength = require('../internals/array-set-length');
|
|
var deletePropertyOrThrow = require('../internals/delete-property-or-throw');
|
|
var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
|
|
|
|
// IE8-
|
|
var INCORRECT_RESULT = [].unshift(0) !== 1;
|
|
|
|
// V8 ~ Chrome < 71 and Safari <= 15.4, FF < 23 throws InternalError
|
|
var properErrorOnNonWritableLength = function () {
|
|
try {
|
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
Object.defineProperty([], 'length', { writable: false }).unshift();
|
|
} catch (error) {
|
|
return error instanceof TypeError;
|
|
}
|
|
};
|
|
|
|
var FORCED = INCORRECT_RESULT || !properErrorOnNonWritableLength();
|
|
|
|
// `Array.prototype.unshift` method
|
|
// https://tc39.es/ecma262/#sec-array.prototype.unshift
|
|
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
unshift: function unshift(item) {
|
|
var O = toObject(this);
|
|
var len = lengthOfArrayLike(O);
|
|
var argCount = arguments.length;
|
|
if (argCount) {
|
|
doesNotExceedSafeInteger(len + argCount);
|
|
var k = len;
|
|
while (k--) {
|
|
var to = k + argCount;
|
|
if (k in O) O[to] = O[k];
|
|
else deletePropertyOrThrow(O, to);
|
|
}
|
|
for (var j = 0; j < argCount; j++) {
|
|
O[j] = arguments[j];
|
|
}
|
|
} return setArrayLength(O, len + argCount);
|
|
}
|
|
});
|