-
Notifications
You must be signed in to change notification settings - Fork 1
feat: skip attaching the launcher when its embedded and update tests #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -577,6 +577,14 @@ describe('Rokt Forwarder', () => { | |||||||
| }); | ||||||||
|
|
||||||||
| it('should add a performance marker when the script is appended', async () => { | ||||||||
| var savedRokt = window.mParticle.Rokt; | ||||||||
| window.Rokt = undefined; | ||||||||
| window.mParticle.Rokt = { | ||||||||
| domain: 'apps.rokt.com', | ||||||||
| attachKit: async () => Promise.resolve(), | ||||||||
| filters: savedRokt.filters, | ||||||||
|
||||||||
| filters: savedRokt.filters, | |
| filters: savedRokt.filters, | |
| createLauncherCalled: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: How does the launcher get the
accountIdand thelauncherOptionsin this flow?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this else block, reusing an existing launcher that was already created with
accountIdandlauncherOptionsby a previous initialization. The launcher object stores its configuration internally, so we just attach our forwarder instance to it viainitRoktLauncher().Below is my understanding:
First init:
window.Rokt.currentLauncherisundefined→attachLauncher(accountId, launcherOptions)creates a new launcher viacreateLauncher({accountId, ...launcherOptions})→ launcher stores this config internallySubsequent (this else block):
currentLauncheralready exists → we skip creating a new one and just callinitRoktLauncher(existingLauncher)to attach the current forwarder instance to itThe
accountIdandlauncherOptionsshould already be baked into the existing launcher from the first init. Since mParticle workspaces have one Rokt kit configuration, all forwarder instances would be sharing the same accountId.