UNPKG

@datadog/mobile-react-native

Version:

A client-side React Native module to interact with Datadog

28 lines (27 loc) 884 B
/* * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2016-Present Datadog, Inc. */ import { TimeProvider } from './TimeProvider'; export class DefaultTimeProvider extends TimeProvider { canUsePerformanceNow = // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore global.performance && typeof performance.now === 'function'; getTimestamp() { return { unix: Date.now(), reactNative: this.performanceNow() }; } performanceNow() { if (this.canUsePerformanceNow) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore return performance.now(); } return null; } } //# sourceMappingURL=DefaultTimeProvider.js.map