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>
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
/**
|
|
* NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
|
|
* you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var node_1 = require("./node");
|
|
var fallbackGlobalObject = {};
|
|
/**
|
|
* Safely get global scope object
|
|
*
|
|
* @returns Global scope object
|
|
*/
|
|
function getGlobalObject() {
|
|
return (node_1.isNodeEnv()
|
|
? global
|
|
: typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
|
|
? window // eslint-disable-line no-restricted-globals
|
|
: typeof self !== 'undefined'
|
|
? self
|
|
: fallbackGlobalObject);
|
|
}
|
|
exports.getGlobalObject = getGlobalObject;
|
|
/**
|
|
* Returns a global singleton contained in the global `__SENTRY__` object.
|
|
*
|
|
* If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
|
|
* function and added to the `__SENTRY__` object.
|
|
*
|
|
* @param name name of the global singleton on __SENTRY__
|
|
* @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
|
|
* @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `getGlobalObject`'s return value
|
|
* @returns the singleton
|
|
*/
|
|
function getGlobalSingleton(name, creator, obj) {
|
|
var global = (obj || getGlobalObject());
|
|
var __SENTRY__ = (global.__SENTRY__ = global.__SENTRY__ || {});
|
|
var singleton = __SENTRY__[name] || (__SENTRY__[name] = creator());
|
|
return singleton;
|
|
}
|
|
exports.getGlobalSingleton = getGlobalSingleton;
|
|
//# sourceMappingURL=global.js.map
|