@dynatrace/react-native-plugin
Version:
This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.
28 lines (27 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventTimestamp = void 0;
const ConsoleLogger_1 = require("../../core/logging/ConsoleLogger");
class EventTimestamp {
constructor(timestampProvider) {
this.duration = 0;
this.timestampProvider = timestampProvider;
this.startTimestamp = timestampProvider.getCurrentTimestamp();
this.logger = new ConsoleLogger_1.ConsoleLogger('EventTimestamp');
}
getEventTimeInfo() {
return {
duration: this.duration,
start_time: this.startTimestamp,
};
}
setEndTimestamp(endTimestamp = this.timestampProvider.getCurrentTimestamp()) {
if (endTimestamp > this.startTimestamp) {
this.duration = endTimestamp - this.startTimestamp;
}
else {
this.logger.debug(`End timestamp (${endTimestamp}) can't be before start timestamp (${this.startTimestamp})!`);
}
}
}
exports.EventTimestamp = EventTimestamp;