@@ -181,12 +181,14 @@ export interface Client<O extends ClientOptions = ClientOptions> {
181
181
/**
182
182
* Register a callback for whenever a span is started.
183
183
* Receives the span as argument.
184
+ * @returns A function that, when executed, removes the registered callback.
184
185
*/
185
- on ( hook : 'spanStart' , callback : ( span : Span ) => void ) : void ;
186
+ on ( hook : 'spanStart' , callback : ( span : Span ) => void ) : ( ) => void ;
186
187
187
188
/**
188
189
* Register a callback before span sampling runs. Receives a `samplingDecision` object argument with a `decision`
189
190
* property that can be used to make a sampling decision that will be enforced, before any span sampling runs.
191
+ * @returns A function that, when executed, removes the registered callback.
190
192
*/
191
193
on (
192
194
hook : 'beforeSampling' ,
@@ -204,83 +206,96 @@ export interface Client<O extends ClientOptions = ClientOptions> {
204
206
/**
205
207
* Register a callback for whenever a span is ended.
206
208
* Receives the span as argument.
209
+ * @returns A function that, when executed, removes the registered callback.
207
210
*/
208
- on ( hook : 'spanEnd' , callback : ( span : Span ) => void ) : void ;
211
+ on ( hook : 'spanEnd' , callback : ( span : Span ) => void ) : ( ) => void ;
209
212
210
213
/**
211
214
* Register a callback for when an idle span is allowed to auto-finish.
215
+ * @returns A function that, when executed, removes the registered callback.
212
216
*/
213
- on ( hook : 'idleSpanEnableAutoFinish' , callback : ( span : Span ) => void ) : void ;
217
+ on ( hook : 'idleSpanEnableAutoFinish' , callback : ( span : Span ) => void ) : ( ) => void ;
214
218
215
219
/**
216
220
* Register a callback for transaction start and finish.
221
+ * @returns A function that, when executed, removes the registered callback.
217
222
*/
218
- on ( hook : 'beforeEnvelope' , callback : ( envelope : Envelope ) => void ) : void ;
223
+ on ( hook : 'beforeEnvelope' , callback : ( envelope : Envelope ) => void ) : ( ) => void ;
219
224
220
225
/**
221
226
* Register a callback for before sending an event.
222
227
* This is called right before an event is sent and should not be used to mutate the event.
223
228
* Receives an Event & EventHint as arguments.
229
+ * @returns A function that, when executed, removes the registered callback.
224
230
*/
225
- on ( hook : 'beforeSendEvent' , callback : ( event : Event , hint ?: EventHint | undefined ) => void ) : void ;
231
+ on ( hook : 'beforeSendEvent' , callback : ( event : Event , hint ?: EventHint | undefined ) => void ) : ( ) => void ;
226
232
227
233
/**
228
234
* Register a callback for preprocessing an event,
229
235
* before it is passed to (global) event processors.
230
236
* Receives an Event & EventHint as arguments.
237
+ * @returns A function that, when executed, removes the registered callback.
231
238
*/
232
- on ( hook : 'preprocessEvent' , callback : ( event : Event , hint ?: EventHint | undefined ) => void ) : void ;
239
+ on ( hook : 'preprocessEvent' , callback : ( event : Event , hint ?: EventHint | undefined ) => void ) : ( ) => void ;
233
240
234
241
/**
235
242
* Register a callback for when an event has been sent.
243
+ * @returns A function that, when executed, removes the registered callback.
236
244
*/
237
- on ( hook : 'afterSendEvent' , callback : ( event : Event , sendResponse : TransportMakeRequestResponse ) => void ) : void ;
245
+ on ( hook : 'afterSendEvent' , callback : ( event : Event , sendResponse : TransportMakeRequestResponse ) => void ) : ( ) => void ;
238
246
239
247
/**
240
248
* Register a callback before a breadcrumb is added.
249
+ * @returns A function that, when executed, removes the registered callback.
241
250
*/
242
- on ( hook : 'beforeAddBreadcrumb' , callback : ( breadcrumb : Breadcrumb , hint ?: BreadcrumbHint ) => void ) : void ;
251
+ on ( hook : 'beforeAddBreadcrumb' , callback : ( breadcrumb : Breadcrumb , hint ?: BreadcrumbHint ) => void ) : ( ) => void ;
243
252
244
253
/**
245
254
* Register a callback when a DSC (Dynamic Sampling Context) is created.
255
+ * @returns A function that, when executed, removes the registered callback.
246
256
*/
247
- on ( hook : 'createDsc' , callback : ( dsc : DynamicSamplingContext ) => void ) : void ;
257
+ on ( hook : 'createDsc' , callback : ( dsc : DynamicSamplingContext ) => void ) : ( ) => void ;
248
258
249
259
/**
250
260
* Register a callback when a Feedback event has been prepared.
251
261
* This should be used to mutate the event. The options argument can hint
252
262
* about what kind of mutation it expects.
263
+ * @returns A function that, when executed, removes the registered callback.
253
264
*/
254
265
on (
255
266
hook : 'beforeSendFeedback' ,
256
267
callback : ( feedback : FeedbackEvent , options ?: { includeReplay ?: boolean } ) => void ,
257
- ) : void ;
268
+ ) : ( ) => void ;
258
269
259
270
/**
260
271
* A hook for the browser tracing integrations to trigger a span start for a page load.
272
+ * @returns A function that, when executed, removes the registered callback.
261
273
*/
262
274
on (
263
275
hook : 'startPageLoadSpan' ,
264
276
callback : (
265
277
options : StartSpanOptions ,
266
278
traceOptions ?: { sentryTrace ?: string | undefined ; baggage ?: string | undefined } ,
267
279
) => void ,
268
- ) : void ;
280
+ ) : ( ) => void ;
269
281
270
282
/**
271
283
* A hook for browser tracing integrations to trigger a span for a navigation.
284
+ * @returns A function that, when executed, removes the registered callback.
272
285
*/
273
- on ( hook : 'startNavigationSpan' , callback : ( options : StartSpanOptions ) => void ) : void ;
286
+ on ( hook : 'startNavigationSpan' , callback : ( options : StartSpanOptions ) => void ) : ( ) => void ;
274
287
275
288
/**
276
289
* A hook that is called when the client is flushing
290
+ * @returns A function that, when executed, removes the registered callback.
277
291
*/
278
- on ( hook : 'flush' , callback : ( ) => void ) : void ;
292
+ on ( hook : 'flush' , callback : ( ) => void ) : ( ) => void ;
279
293
280
294
/**
281
295
* A hook that is called when the client is closing
296
+ * @returns A function that, when executed, removes the registered callback.
282
297
*/
283
- on ( hook : 'close' , callback : ( ) => void ) : void ;
298
+ on ( hook : 'close' , callback : ( ) => void ) : ( ) => void ;
284
299
285
300
/** Fire a hook whener a span starts. */
286
301
emit ( hook : 'spanStart' , span : Span ) : void ;
0 commit comments