An interface used for the notification listener.

interface INotificationListener {
    eventsDiscarded?: ((events: ITelemetryItem[], reason: number) => void);
    eventsSendRequest?: ((sendReason: number, isAsync?: boolean) => void);
    eventsSent?: ((events: ITelemetryItem[]) => void);
    offlineBatchDrop?(cnt: number, reason?: number): void;
    offlineBatchSent?(batch: IPayloadData): void;
    offlineEventsStored?(events: ITelemetryItem[]): void;
    perfEvent?: ((perfEvent: IPerfEvent) => void);
    unload?(isAsync?: boolean): void | IPromise<void>;
}

Properties

eventsDiscarded?: ((events: ITelemetryItem[], reason: number) => void)

[Optional] A function called when events are discarded.

Type declaration

    • (events, reason): void
    • Parameters

      • events: ITelemetryItem[]

        The array of events that have been discarded.

      • reason: number

        The reason for discarding the events. The EventsDiscardedReason constant should be used to check the different values.

      Returns void

eventsSendRequest?: ((sendReason: number, isAsync?: boolean) => void)

[Optional] A function called when the events have been requested to be sent to the sever.

Type declaration

    • (sendReason, isAsync?): void
    • Parameters

      • sendReason: number

        The reason why the event batch is being sent.

      • OptionalisAsync: boolean

        A flag which identifies whether the requests are being sent in an async or sync manner.

      Returns void

eventsSent?: ((events: ITelemetryItem[]) => void)

[Optional] A function called when events are sent.

Type declaration

    • (events): void
    • Parameters

      Returns void

perfEvent?: ((perfEvent: IPerfEvent) => void)

[Optional] This event is sent if you have enabled perf events, they are primarily used to track internal performance testing and debugging the event can be displayed via the debug plugin extension.

Methods

  • [Optional] A function called when the offline events have been dropped from the persistent storage

    Parameters

    • cnt: number

      count of batches dropped

    • Optionalreason: number

      the reason why the batches is dropped

    Returns void

    v3.1.1

  • Unload and remove any state that this INotificationListener may be holding, this is generally called when the owning Manager is being unloaded.

    Parameters

    • OptionalisAsync: boolean

      Can the unload be performed asynchronously (default)

    Returns void | IPromise<void>

    If the unload occurs synchronously then nothing should be returned, if happening asynchronously then the function should return an IPromise / Promise to allow any listeners to wait for the operation to complete.