@esri/arcgis-rest-request
Version:
Common methods and utilities for @esri/arcgis-rest-js packages.
26 lines • 1.16 kB
JavaScript
;
/* istanbul ignore file */
// Note: currently this is all internal to the package, and we are not exposing
// anything that a user can set... but we need all this to be able to ensure
// that multiple instances of the package can share the same config.
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestConfig = void 0;
/**
* The default config for the request module. This is used to store
* the no-cors domains and pending requests.
*/
const DEFAULT_ARCGIS_REQUEST_CONFIG = {
noCorsDomains: [],
crossOriginNoCorsDomains: {},
pendingNoCorsRequests: {}
};
const GLOBAL_VARIABLE_NAME = "ARCGIS_REST_JS_NO_CORS";
// Set the global variable to the default config if it is not aleady defined
// This is done to ensure that all instances of rest-request work with a single
// instance of the config
if (!globalThis[GLOBAL_VARIABLE_NAME]) {
globalThis[GLOBAL_VARIABLE_NAME] = Object.assign({}, DEFAULT_ARCGIS_REQUEST_CONFIG);
}
// export the settings as immutable consts that read from the global config
exports.requestConfig = globalThis[GLOBAL_VARIABLE_NAME];
//# sourceMappingURL=requestConfig.js.map