Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.16 KB

DeveloperAPIReferenceEventsJS.md

File metadata and controls

35 lines (23 loc) · 1.16 KB

Events API Reference for React Native / JavaScript

The Events instrument lets you add lightweight instrumentation to your code for collection and visualization by Detox Instruments. You can specify interesting periods of time ('intervals') and single points in time ('events'). Each event can be marked as completed or errored, or as 12 different general-purpose categories, each displayed with its own color in the timeline pane.

Before using the provided developer APIs, first complete the Profiler Framework Integration Guide.

For React Native apps, you need to install the detox-instruments-react-native-utils package:

npm install detox-instruments-react-native-utils --save-prod

Import the Event class from the package:

import { Event } from 'detox-instruments-react-native-utils';

Usage

Intervals

let event = new Event("Category", "Name");
event.beginInterval("Start message");
//Long interval
event.endInterval(Event.EventStatus.completed, "End message");

Single Points in Time

Event.event("Category", "Name", Event.EventStatus.completed, "Message");