UNPKG

@datadog/mobile-react-native

Version:

A client-side React Native module to interact with Datadog

35 lines (32 loc) 991 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.adaptLongTaskThreshold = void 0; /** * 100ms is the lower bound for a noticeable long task event. */ const MIN_LONG_TASK_THRESHOLD_MS = 100; /** * 5000ms is considered an Application Not Responding (ANR) event. */ const MAX_LONG_TASK_THRESHOLD_MS = 5000; /** * Makes sure the long task threshold value is above 100 and below 5000. * Also makes sure it is a number, passing `0` if it is `false`, as the React Native * bridge cannot handle values with dual types. */ const adaptLongTaskThreshold = longTaskThreshold => { if (!longTaskThreshold) { return 0; } if (longTaskThreshold < MIN_LONG_TASK_THRESHOLD_MS) { return MIN_LONG_TASK_THRESHOLD_MS; } if (longTaskThreshold > MAX_LONG_TASK_THRESHOLD_MS) { return MAX_LONG_TASK_THRESHOLD_MS; } return longTaskThreshold; }; exports.adaptLongTaskThreshold = adaptLongTaskThreshold; //# sourceMappingURL=longTasksUtils.js.map