import InstrumentationModule from '../../native/InstrumentationModule'; // eslint-disable-next-line @typescript-eslint/no-unused-vars import type useScreenTracker from './useScreenTracker'; type SessionFrame = { updateName: (newName: string) => Promise; end: () => Promise; }; /** * Object used to manually track custom screen frames throughout the app. * * @param {string} name Name of the new frame. * @see {@linkcode useScreenTracker} for a more specialized screen tracking mechanism. */ async function startSessionFrame(name: string): Promise { const id = await InstrumentationModule.startSessionFrame(name); /** * Updates the name of the session frame. * This is generally used when the best name for the Session Frame * is not known at the time of its creation. * * @param {string} newName New name for the tracked frame. */ async function updateName(newName: string): Promise { await InstrumentationModule.updateSessionFrameName(id, newName); } /** * Reports the end of the session frame. * The {@link SessionFrame} object will no longer be useable after this call. * This method is thread safe. */ async function end(): Promise { await InstrumentationModule.endSessionFrame(id); } return {updateName, end}; } export {startSessionFrame, type SessionFrame};