UNPKG

@grafana/faro-core

Version:
26 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBundleId = getBundleId; exports.getGitHash = getGitHash; const globalObject_1 = require("../globalObject"); /** * Reads the bundle id injected by `@grafana/faro-metro-plugin` / webpack plugin preamble. * Prefer `globalObject` (globalThis-first). Also check `window` for older bundles that set the * property only on `window` when it differed from `globalThis` (e.g. legacy preamble order). */ function getBundleId(appName) { const key = `__faroBundleId_${appName}`; const fromGlobal = globalObject_1.globalObject === null || globalObject_1.globalObject === void 0 ? void 0 : globalObject_1.globalObject[key]; if (typeof fromGlobal === 'string' && fromGlobal !== '') { return fromGlobal; } const fromWindow = typeof window !== 'undefined' ? window[key] : undefined; if (typeof fromWindow === 'string' && fromWindow !== '') { return fromWindow; } return undefined; } function getGitHash(appName) { return globalObject_1.globalObject === null || globalObject_1.globalObject === void 0 ? void 0 : globalObject_1.globalObject[`__faroGitHash_${appName}`]; } //# sourceMappingURL=sourceMaps.js.map