From 9b2d7fb37d782a9b19473084e8b95025cca22500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Wed, 13 Nov 2024 13:39:37 +0100 Subject: [PATCH] Update API docs --- .../docs/browser-tracker/browser-tracker.api.md | 2 ++ ...owser-tracker.coreplugin.deactivateplugin.md | 13 +++++++++++++ .../markdown/browser-tracker.coreplugin.md | 1 + .../browser-tracker.trackerconfiguration.md | 1 - .../browser-tracker.trackercore.deactivate.md | 17 +++++++++++++++++ .../markdown/browser-tracker.trackercore.md | 1 + 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.deactivateplugin.md create mode 100644 api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.deactivate.md diff --git a/api-docs/docs/browser-tracker/browser-tracker.api.md b/api-docs/docs/browser-tracker/browser-tracker.api.md index e571532a5..ad352f319 100644 --- a/api-docs/docs/browser-tracker/browser-tracker.api.md +++ b/api-docs/docs/browser-tracker/browser-tracker.api.md @@ -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; } @@ -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): void; resetPayloadPairs(dict: Payload): void; diff --git a/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.deactivateplugin.md b/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.deactivateplugin.md new file mode 100644 index 000000000..5d63baf9d --- /dev/null +++ b/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.deactivateplugin.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@snowplow/browser-tracker](./browser-tracker.md) > [CorePlugin](./browser-tracker.coreplugin.md) > [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. + +Signature: + +```typescript +deactivatePlugin?: (core: TrackerCore) => void; +``` diff --git a/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.md b/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.md index 52b891986..a224db7cc 100644 --- a/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.md +++ b/api-docs/docs/browser-tracker/markdown/browser-tracker.coreplugin.md @@ -20,6 +20,7 @@ interface CorePlugin | [afterTrack?](./browser-tracker.coreplugin.aftertrack.md) | (payload: Payload) => void | (Optional) Called just after the trackerCore callback fires | | [beforeTrack?](./browser-tracker.coreplugin.beforetrack.md) | (payloadBuilder: PayloadBuilder) => void | (Optional) Called before the filter method is called and before the trackerCore callback fires (if the filter passes) | | [contexts?](./browser-tracker.coreplugin.contexts.md) | () => SelfDescribingJson\[\] | (Optional) Called when constructing the context for each event Useful for adding additional context to events | +| [deactivatePlugin?](./browser-tracker.coreplugin.deactivateplugin.md) | (core: TrackerCore) => void | (Optional) 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) => boolean | (Optional) 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) => void | (Optional) Passed a logger instance which can be used to send log information to the active logger | diff --git a/api-docs/docs/browser-tracker/markdown/browser-tracker.trackerconfiguration.md b/api-docs/docs/browser-tracker/markdown/browser-tracker.trackerconfiguration.md index 89fb83857..04b2fafda 100644 --- a/api-docs/docs/browser-tracker/markdown/browser-tracker.trackerconfiguration.md +++ b/api-docs/docs/browser-tracker/markdown/browser-tracker.trackerconfiguration.md @@ -44,6 +44,5 @@ newTracker('sp1', 'collector.my-website.com', { plugins: [ PerformanceTimingPlugin(), AdTrackingPlugin() ], stateStorageStrategy: 'cookieAndLocalStorage' }); - ``` diff --git a/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.deactivate.md b/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.deactivate.md new file mode 100644 index 000000000..74ac88a56 --- /dev/null +++ b/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.deactivate.md @@ -0,0 +1,17 @@ + + +[Home](./index.md) > [@snowplow/browser-tracker](./browser-tracker.md) > [TrackerCore](./browser-tracker.trackercore.md) > [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. + +Signature: + +```typescript +deactivate(): void; +``` +Returns: + +void + diff --git a/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.md b/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.md index 48a955801..f61d52fb9 100644 --- a/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.md +++ b/api-docs/docs/browser-tracker/markdown/browser-tracker.trackercore.md @@ -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 |