UNPKG

@grafana/faro-web-sdk

Version:

Faro instrumentations, metas, transports for web.

28 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ViewInstrumentation = void 0; const faro_core_1 = require("@grafana/faro-core"); // all this does is send VIEW_CHANGED event class ViewInstrumentation extends faro_core_1.BaseInstrumentation { constructor() { super(...arguments); this.name = '@grafana/faro-web-sdk:instrumentation-view'; this.version = faro_core_1.VERSION; } sendViewChangedEvent(meta) { var _a, _b, _c, _d; const view = meta.view; if (view && view.name !== ((_a = this.notifiedView) === null || _a === void 0 ? void 0 : _a.name)) { this.api.pushEvent(faro_core_1.EVENT_VIEW_CHANGED, { fromView: (_c = (_b = this.notifiedView) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : faro_core_1.unknownString, toView: (_d = view.name) !== null && _d !== void 0 ? _d : faro_core_1.unknownString, }, undefined, { skipDedupe: true }); this.notifiedView = view; } } initialize() { this.metas.addListener(this.sendViewChangedEvent.bind(this)); } } exports.ViewInstrumentation = ViewInstrumentation; //# sourceMappingURL=instrumentation.js.map