Skip to content

Commit

Permalink
Update API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein committed Nov 13, 2024
1 parent e69d168 commit 9b2d7fb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api-docs/docs/browser-tracker/browser-tracker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,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 @@ -545,6 +546,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/browser-tracker](./browser-tracker.md) &gt; [CorePlugin](./browser-tracker.coreplugin.md) &gt; [deactivatePlugin](./browser-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?](./browser-tracker.coreplugin.aftertrack.md) | (payload: Payload) =&gt; void | <i>(Optional)</i> Called just after the trackerCore callback fires |
| [beforeTrack?](./browser-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?](./browser-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?](./browser-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?](./browser-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?](./browser-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
Expand Up @@ -44,6 +44,5 @@ newTracker('sp1', 'collector.my-website.com', {
plugins: [ PerformanceTimingPlugin(), AdTrackingPlugin() ],
stateStorageStrategy: 'cookieAndLocalStorage'
});
```

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/browser-tracker](./browser-tracker.md) &gt; [TrackerCore](./browser-tracker.trackercore.md) &gt; [deactivate](./browser-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)](./browser-tracker.trackercore.addpayloaddict.md) | Merges a dictionary into payloadPairs |
| [addPlugin(configuration)](./browser-tracker.trackercore.addplugin.md) | Add a plugin into the plugin collection after Core has already been initialised |
| [clearGlobalContexts()](./browser-tracker.trackercore.clearglobalcontexts.md) | Removes all global contexts |
| [deactivate()](./browser-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()](./browser-tracker.trackercore.getbase64encoding.md) | Get current base64 encoding state |
| [removeGlobalContexts(contexts)](./browser-tracker.trackercore.removeglobalcontexts.md) | Removes previously added global context, performs a deep comparison of the contexts or conditional contexts |
| [resetPayloadPairs(dict)](./browser-tracker.trackercore.resetpayloadpairs.md) | Replace payloadPairs with a new dictionary |
Expand Down

0 comments on commit 9b2d7fb

Please sign in to comment.