Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Nov 13, 2024
1 parent c8e742b commit 879d40c
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/node-tracker](./node-tracker.md) &gt; [CorePlugin](./node-tracker.coreplugin.md) &gt; [deactivatePlugin](./node-tracker.coreplugin.deactivateplugin.md)

## CorePlugin.deactivatePlugin property

Called when the tracker is being destroyed. Should be used to clean up any resources or listeners that the plugin has created.

<b>Signature:</b>

```typescript
deactivatePlugin?: (core: TrackerCore) => void;
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface CorePlugin
| [afterTrack?](./node-tracker.coreplugin.aftertrack.md) | (payload: Payload) =&gt; void | <i>(Optional)</i> Called just after the trackerCore callback fires |
| [beforeTrack?](./node-tracker.coreplugin.beforetrack.md) | (payloadBuilder: PayloadBuilder) =&gt; void | <i>(Optional)</i> Called before the <code>filter</code> method is called and before the trackerCore callback fires (if the filter passes) |
| [contexts?](./node-tracker.coreplugin.contexts.md) | () =&gt; SelfDescribingJson\[\] | <i>(Optional)</i> Called when constructing the context for each event Useful for adding additional context to events |
| [deactivatePlugin?](./node-tracker.coreplugin.deactivateplugin.md) | (core: TrackerCore) =&gt; void | <i>(Optional)</i> Called when the tracker is being destroyed. Should be used to clean up any resources or listeners that the plugin has created. |
| [filter?](./node-tracker.coreplugin.filter.md) | (payload: Payload) =&gt; boolean | <i>(Optional)</i> Called before the payload is sent to the callback to decide whether to send the payload or skip it |
| [logger?](./node-tracker.coreplugin.logger.md) | (logger: Logger) =&gt; void | <i>(Optional)</i> Passed a logger instance which can be used to send log information to the active logger |

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/node-tracker](./node-tracker.md) &gt; [TrackerCore](./node-tracker.trackercore.md) &gt; [deactivate](./node-tracker.trackercore.deactivate.md)

## TrackerCore.deactivate() method

Deactivate tracker core including all plugins. This is useful for cleaning up resources or listeners that have been created. Once deactivated, the tracker won't be able to track any events.

<b>Signature:</b>

```typescript
deactivate(): void;
```
<b>Returns:</b>

void

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface TrackerCore
| [addPayloadDict(dict)](./node-tracker.trackercore.addpayloaddict.md) | Merges a dictionary into payloadPairs |
| [addPlugin(configuration)](./node-tracker.trackercore.addplugin.md) | Add a plugin into the plugin collection after Core has already been initialised |
| [clearGlobalContexts()](./node-tracker.trackercore.clearglobalcontexts.md) | Removes all global contexts |
| [deactivate()](./node-tracker.trackercore.deactivate.md) | Deactivate tracker core including all plugins. This is useful for cleaning up resources or listeners that have been created. Once deactivated, the tracker won't be able to track any events. |
| [getBase64Encoding()](./node-tracker.trackercore.getbase64encoding.md) | Get current base64 encoding state |
| [removeGlobalContexts(contexts)](./node-tracker.trackercore.removeglobalcontexts.md) | Removes previously added global context, performs a deep comparison of the contexts or conditional contexts |
| [resetPayloadPairs(dict)](./node-tracker.trackercore.resetpayloadpairs.md) | Replace payloadPairs with a new dictionary |
Expand Down
2 changes: 2 additions & 0 deletions api-docs/docs/node-tracker/node-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export interface CorePlugin {
afterTrack?: (payload: Payload) => void;
beforeTrack?: (payloadBuilder: PayloadBuilder) => void;
contexts?: () => SelfDescribingJson[];
deactivatePlugin?: (core: TrackerCore) => void;
filter?: (payload: Payload) => boolean;
logger?: (logger: Logger) => void;
}
Expand Down Expand Up @@ -527,6 +528,7 @@ export interface TrackerCore {
addPayloadPair: (key: string, value: unknown) => void;
addPlugin(configuration: CorePluginConfiguration): void;
clearGlobalContexts(): void;
deactivate(): void;
getBase64Encoding(): boolean;
removeGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive | string>): void;
resetPayloadPairs(dict: Payload): void;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [CorePlugin](./react-native-tracker.coreplugin.md) &gt; [deactivatePlugin](./react-native-tracker.coreplugin.deactivateplugin.md)

## CorePlugin.deactivatePlugin property

Called when the tracker is being destroyed. Should be used to clean up any resources or listeners that the plugin has created.

<b>Signature:</b>

```typescript
deactivatePlugin?: (core: TrackerCore) => void;
```
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface CorePlugin
| [afterTrack?](./react-native-tracker.coreplugin.aftertrack.md) | (payload: Payload) =&gt; void | <i>(Optional)</i> Called just after the trackerCore callback fires |
| [beforeTrack?](./react-native-tracker.coreplugin.beforetrack.md) | (payloadBuilder: PayloadBuilder) =&gt; void | <i>(Optional)</i> Called before the <code>filter</code> method is called and before the trackerCore callback fires (if the filter passes) |
| [contexts?](./react-native-tracker.coreplugin.contexts.md) | () =&gt; SelfDescribingJson\[\] | <i>(Optional)</i> Called when constructing the context for each event Useful for adding additional context to events |
| [deactivatePlugin?](./react-native-tracker.coreplugin.deactivateplugin.md) | (core: TrackerCore) =&gt; void | <i>(Optional)</i> Called when the tracker is being destroyed. Should be used to clean up any resources or listeners that the plugin has created. |
| [filter?](./react-native-tracker.coreplugin.filter.md) | (payload: Payload) =&gt; boolean | <i>(Optional)</i> Called before the payload is sent to the callback to decide whether to send the payload or skip it |
| [logger?](./react-native-tracker.coreplugin.logger.md) | (logger: Logger) =&gt; void | <i>(Optional)</i> Passed a logger instance which can be used to send log information to the active logger |

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [getTracker](./react-native-tracker.gettracker.md)

## getTracker() function

Retrieves an initialized tracker given its namespace

<b>Signature:</b>

```typescript
export declare function getTracker(trackerNamespace: string): ReactNativeTracker | undefined;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| trackerNamespace | string | Tracker namespace |

<b>Returns:</b>

[ReactNativeTracker](./react-native-tracker.reactnativetracker.md) \| undefined

Tracker instance if exists

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

| Function | Description |
| --- | --- |
| [getTracker(trackerNamespace)](./react-native-tracker.gettracker.md) | Retrieves an initialized tracker given its namespace |
| [newTracker(configuration)](./react-native-tracker.newtracker.md) | Creates a new tracker instance with the given configuration |
| [removeAllTrackers()](./react-native-tracker.removealltrackers.md) | Removes all initialized trackers |
| [removeTracker(trackerNamespace)](./react-native-tracker.removetracker.md) | Removes a tracker given its namespace |

## Interfaces

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [removeAllTrackers](./react-native-tracker.removealltrackers.md)

## removeAllTrackers() function

Removes all initialized trackers

<b>Signature:</b>

```typescript
export declare function removeAllTrackers(): void;
```
<b>Returns:</b>

void

- A boolean promise

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [removeTracker](./react-native-tracker.removetracker.md)

## removeTracker() function

Removes a tracker given its namespace

<b>Signature:</b>

```typescript
export declare function removeTracker(trackerNamespace: string): void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| trackerNamespace | string | Tracker namespace |

<b>Returns:</b>

void

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [TrackerCore](./react-native-tracker.trackercore.md) &gt; [deactivate](./react-native-tracker.trackercore.deactivate.md)

## TrackerCore.deactivate() method

Deactivate tracker core including all plugins. This is useful for cleaning up resources or listeners that have been created. Once deactivated, the tracker won't be able to track any events.

<b>Signature:</b>

```typescript
deactivate(): void;
```
<b>Returns:</b>

void

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface TrackerCore
| [addPayloadDict(dict)](./react-native-tracker.trackercore.addpayloaddict.md) | Merges a dictionary into payloadPairs |
| [addPlugin(configuration)](./react-native-tracker.trackercore.addplugin.md) | Add a plugin into the plugin collection after Core has already been initialised |
| [clearGlobalContexts()](./react-native-tracker.trackercore.clearglobalcontexts.md) | Removes all global contexts |
| [deactivate()](./react-native-tracker.trackercore.deactivate.md) | Deactivate tracker core including all plugins. This is useful for cleaning up resources or listeners that have been created. Once deactivated, the tracker won't be able to track any events. |
| [getBase64Encoding()](./react-native-tracker.trackercore.getbase64encoding.md) | Get current base64 encoding state |
| [removeGlobalContexts(contexts)](./react-native-tracker.trackercore.removeglobalcontexts.md) | Removes previously added global context, performs a deep comparison of the contexts or conditional contexts |
| [resetPayloadPairs(dict)](./react-native-tracker.trackercore.resetpayloadpairs.md) | Replace payloadPairs with a new dictionary |
Expand Down
11 changes: 11 additions & 0 deletions api-docs/docs/react-native-tracker/react-native-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface CorePlugin {
afterTrack?: (payload: Payload) => void;
beforeTrack?: (payloadBuilder: PayloadBuilder) => void;
contexts?: () => SelfDescribingJson[];
deactivatePlugin?: (core: TrackerCore) => void;
filter?: (payload: Payload) => boolean;
logger?: (logger: Logger) => void;
}
Expand Down Expand Up @@ -179,6 +180,9 @@ export interface FormFocusOrChangeEvent {
value: string | null;
}

// @public
export function getTracker(trackerNamespace: string): ReactNativeTracker | undefined;

// @public
export type JsonProcessor = (payloadBuilder: PayloadBuilder, jsonForProcessing: EventJson, contextEntitiesForProcessing: SelfDescribingJson[]) => void;

Expand Down Expand Up @@ -298,6 +302,12 @@ export type ReactNativeTracker = {
readonly setSubjectData: (config: SubjectConfiguration) => void;
};

// @public
export function removeAllTrackers(): void;

// @public
export function removeTracker(trackerNamespace: string): void;

// @public
export type RequestFailure = {
events: EventBatch;
Expand Down Expand Up @@ -409,6 +419,7 @@ export interface TrackerCore {
addPayloadPair: (key: string, value: unknown) => void;
addPlugin(configuration: CorePluginConfiguration): void;
clearGlobalContexts(): void;
deactivate(): void;
getBase64Encoding(): boolean;
removeGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive | string>): void;
resetPayloadPairs(dict: Payload): void;
Expand Down
4 changes: 2 additions & 2 deletions trackers/react-native-tracker/src/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function newTracker(

/**
* Retrieves an initialized tracker given its namespace
* @param trackerNamespace Tracker namespace
* @param trackerNamespace - Tracker namespace
* @returns Tracker instance if exists
*/
export function getTracker(trackerNamespace: string): ReactNativeTracker | undefined {
Expand All @@ -74,7 +74,7 @@ export function getTracker(trackerNamespace: string): ReactNativeTracker | undef
/**
* Removes a tracker given its namespace
*
* @param trackerNamespace {string}
* @param trackerNamespace - Tracker namespace
*/
export function removeTracker(trackerNamespace: string): void {
if (initializedTrackers[trackerNamespace]) {
Expand Down

0 comments on commit 879d40c

Please sign in to comment.