From 65b2dd5519ef2a767db1618d3b9e122dd91e42bf Mon Sep 17 00:00:00 2001 From: emkis Date: Sun, 1 May 2022 19:13:26 -0300 Subject: [PATCH] feat(tracker-context): add context options --- src/tracker-context/tracker-context.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tracker-context/tracker-context.ts b/src/tracker-context/tracker-context.ts index 5abb5b4..2db9a63 100644 --- a/src/tracker-context/tracker-context.ts +++ b/src/tracker-context/tracker-context.ts @@ -1,5 +1,8 @@ import type { EventProperties } from '../data-layer' -import type { TrackerContext } from './tracker-context-types' +import type { + TrackerContext, + TrackerContextOptions, +} from './tracker-context-types' /** * Creates a context for track events. @@ -8,6 +11,7 @@ import type { TrackerContext } from './tracker-context-types' * track event that uses this context. * * @param initialProps - Properties witch will initialize the context. + * @param options - Options for customizing the Tracker Context. * @public * @example * createTrackerContext({ @@ -17,9 +21,13 @@ import type { TrackerContext } from './tracker-context-types' * }) */ export function createTrackerContext( - initialProps: EventProperties = {} + initialProps: EventProperties = {}, + options: TrackerContextOptions = {} ): TrackerContext { - const context = { value: { ...initialProps } } + const context = { + options, + value: { ...initialProps }, + } function setProps(props: EventProperties) { context.value = { ...props }