Skip to content

Commit

Permalink
feat(tracker-context): add context options
Browse files Browse the repository at this point in the history
  • Loading branch information
emkis committed May 1, 2022
1 parent b270b74 commit 65b2dd5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/tracker-context/tracker-context.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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({
Expand All @@ -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 }
Expand Down

0 comments on commit 65b2dd5

Please sign in to comment.