@@ -15,9 +15,12 @@ import com.facebook.react.bridge.ReadableMap
1515 * The entry point to use Datadog's RUM feature.
1616 */
1717@Suppress(" TooManyFunctions" )
18- class DdRum (reactContext : ReactApplicationContext ) : NativeDdRumSpec(reactContext) {
18+ class DdRum (
19+ reactContext : ReactApplicationContext ,
20+ datadogWrapper : DatadogWrapper = DatadogSDKWrapper ()
21+ ) : NativeDdRumSpec(reactContext) {
1922
20- private val implementation = DdRumImplementation ()
23+ private val implementation = DdRumImplementation (datadog = datadogWrapper )
2124
2225 override fun getName (): String = DdRumImplementation .NAME
2326
@@ -26,7 +29,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
2629 * @param key The view unique key identifier.
2730 * @param name The view name.
2831 * @param context The additional context to send.
29- * @param timestampMs The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
32+ * @param timestampMs The timestamp when the view started (in milliseconds). If not provided,
33+ * current timestamp will be used.
3034 */
3135 @ReactMethod
3236 override fun startView (
@@ -43,7 +47,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
4347 * Stop tracking a RUM View.
4448 * @param key The view unique key identifier.
4549 * @param context The additional context to send.
46- * @param timestampMs The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
50+ * @param timestampMs The timestamp when the view stopped (in milliseconds).
51+ * If not provided, current timestamp will be used.
4752 */
4853 @ReactMethod
4954 override fun stopView (key : String , context : ReadableMap , timestampMs : Double , promise : Promise ) {
@@ -55,7 +60,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
5560 * @param type The action type (tap, scroll, swipe, click, custom).
5661 * @param name The action name.
5762 * @param context The additional context to send.
58- * @param timestampMs The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
63+ * @param timestampMs The timestamp when the action started (in milliseconds).
64+ * If not provided, current timestamp will be used.
5965 */
6066 @ReactMethod
6167 override fun startAction (
@@ -73,7 +79,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
7379 * @param type The action type (tap, scroll, swipe, click, custom).
7480 * @param name The action name.
7581 * @param context The additional context to send.
76- * @param timestampMs The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
82+ * @param timestampMs The timestamp when the action stopped (in milliseconds).
83+ * If not provided, current timestamp will be used.
7784 */
7885 @ReactMethod
7986 override fun stopAction (
@@ -91,7 +98,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
9198 * @param type The action type (tap, scroll, swipe, click, custom).
9299 * @param name The action name.
93100 * @param context The additional context to send.
94- * @param timestampMs The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
101+ * @param timestampMs The timestamp when the action occurred (in milliseconds).
102+ * If not provided, current timestamp will be used.
95103 */
96104 @ReactMethod
97105 override fun addAction (
@@ -110,7 +118,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
110118 * @param method The resource method (GET, POST, …).
111119 * @param url The resource url.
112120 * @param context The additional context to send.
113- * @param timestampMs The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
121+ * @param timestampMs The timestamp when the resource started (in milliseconds).
122+ * If not provided, current timestamp will be used.
114123 */
115124 @Suppress(" LongParameterList" )
116125 @ReactMethod
@@ -132,7 +141,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
132141 * @param kind The resource's kind (xhr, document, image, css, font, …).
133142 * @param size The resource size in bytes.
134143 * @param context The additional context to send.
135- * @param timestampMs The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
144+ * @param timestampMs The timestamp when the resource stopped (in milliseconds).
145+ * If not provided, current timestamp will be used.
136146 */
137147 @Suppress(" LongParameterList" )
138148 @ReactMethod
@@ -154,7 +164,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
154164 * @param source The error source (network, source, console, logger, …).
155165 * @param stacktrace The error stacktrace.
156166 * @param context The additional context to send.
157- * @param timestampMs The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
167+ * @param timestampMs The timestamp when the error occurred (in milliseconds).
168+ * If not provided, current timestamp will be used.
158169 */
159170 @Suppress(" LongParameterList" )
160171 @ReactMethod
@@ -170,8 +181,11 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
170181 }
171182
172183 /* *
173- * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.
174- * @param name The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.
184+ * Adds a specific timing in the active View. The timing duration will be computed as the
185+ * difference between the time the View was started and the time this function was called.
186+ * @param name The name of the new custom timing attribute.
187+ * Timings can be nested up to 8 levels deep.
188+ * Names using more than 8 levels will be sanitized by SDK.
175189 */
176190 @ReactMethod
177191 override fun addTiming (name : String , promise : Promise ) {
@@ -188,7 +202,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
188202
189203 /* *
190204 * Adds result of evaluating a feature flag to the view.
191- * Feature flag evaluations are local to the active view and are cleared when the view is stopped.
205+ * Feature flag evaluations are local to the active view and are cleared when the view
206+ * is stopped.
192207 * @param name The name of the feature flag
193208 * @param value The value the feature flag evaluated to, encapsulated in a Map
194209 */
0 commit comments