import InstrumentationModule from '../../native/InstrumentationModule'; import {removeUserDataNumber, setUserDataNumber} from './setUserDataNumber'; // @ts-ignore // eslint-disable-next-line @typescript-eslint/no-unused-vars const {MAX_USER_DATA_STRING_LENGTH} = InstrumentationModule.getConstants(); /** * @deprecated Use {@link setUserDataNumber}. * --- * * Sets a key-value pair identifier that will be included in all snapshots. * The identifier can be used to add any data you wish. * * The `key` must be unique across your application. * The `key` namespace is distinct for each user data type. * Re-using the same `key` overwrites the previous `value`. * The `key` is limited to {@link MAX_USER_DATA_STRING_LENGTH} characters. * * **WARNING:** The JavaScript exact double numbers are limited to the range [-(2^53 - 1) ; 2^53 - 1] as defined * by * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_DOUBLE | MAX_SAFE_DOUBLE} * and * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_DOUBLE | MIN_SAFE_DOUBLE}. * Numbers will be truncated to this range! * * A `value` of `null` will clear the data. * * This information is not persisted across application runs. Once the application is destroyed, * the user data is cleared. * @param {string} key Your unique key. * @param {number} value Your value. */ async function setUserDataDouble( key: string, value: number | null | undefined, ): Promise { if (value == null) { return removeUserDataDouble(key); } await setUserDataNumber(key, value); } /** * @deprecated Use {@link removeUserDataNumber}. * --- * * Removes a key-value pair set with {@link setUserDataDouble}. * The identifier can be used to add any data you wish. * @param {string} key Key of the entry to remove. */ async function removeUserDataDouble(key: string): Promise { await removeUserDataNumber(key); } export {setUserDataDouble, removeUserDataDouble};