UNPKG

2.4 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright (c) Microsoft Corporation. All rights reserved.
4 * Licensed under the MIT License.
5 */
6Object.defineProperty(exports, "__esModule", { value: true });
7var tslib_1 = require("tslib");
8var TelemetryConstants_1 = require("./TelemetryConstants");
9var TelemetryEvent_1 = tslib_1.__importDefault(require("./TelemetryEvent"));
10var TelemetryUtils_1 = require("./TelemetryUtils");
11var DefaultEvent = /** @class */ (function (_super) {
12 tslib_1.__extends(DefaultEvent, _super);
13 // TODO Platform Type
14 function DefaultEvent(platform, correlationId, clientId, eventCount) {
15 var _this = _super.call(this, TelemetryUtils_1.prependEventNamePrefix("default_event"), correlationId, "DefaultEvent") || this;
16 _this.event[TelemetryUtils_1.prependEventNamePrefix("client_id")] = clientId;
17 _this.event[TelemetryUtils_1.prependEventNamePrefix("sdk_plaform")] = platform.sdk;
18 _this.event[TelemetryUtils_1.prependEventNamePrefix("sdk_version")] = platform.sdkVersion;
19 _this.event[TelemetryUtils_1.prependEventNamePrefix("application_name")] = platform.applicationName;
20 _this.event[TelemetryUtils_1.prependEventNamePrefix("application_version")] = platform.applicationVersion;
21 _this.event[TelemetryUtils_1.prependEventNamePrefix("effective_connection_speed")] = platform.networkInformation && platform.networkInformation.connectionSpeed;
22 _this.event["" + TelemetryConstants_1.TELEMETRY_BLOB_EVENT_NAMES.UiEventCountTelemetryBatchKey] = _this.getEventCount(TelemetryUtils_1.prependEventNamePrefix("ui_event"), eventCount);
23 _this.event["" + TelemetryConstants_1.TELEMETRY_BLOB_EVENT_NAMES.HttpEventCountTelemetryBatchKey] = _this.getEventCount(TelemetryUtils_1.prependEventNamePrefix("http_event"), eventCount);
24 _this.event["" + TelemetryConstants_1.TELEMETRY_BLOB_EVENT_NAMES.CacheEventCountConstStrKey] = _this.getEventCount(TelemetryUtils_1.prependEventNamePrefix("cache_event"), eventCount);
25 return _this;
26 // / Device id?
27 }
28 DefaultEvent.prototype.getEventCount = function (eventName, eventCount) {
29 if (!eventCount[eventName]) {
30 return 0;
31 }
32 return eventCount[eventName];
33 };
34 return DefaultEvent;
35}(TelemetryEvent_1.default));
36exports.default = DefaultEvent;
37//# sourceMappingURL=DefaultEvent.js.map
\No newline at end of file