Skip to content

Add tracker.getQueueName method#1217

Open
Peter Perlepes (igneel64) wants to merge 2 commits intomasterfrom
feature/1215-expose-queue-name
Open

Add tracker.getQueueName method#1217
Peter Perlepes (igneel64) wants to merge 2 commits intomasterfrom
feature/1215-expose-queue-name

Conversation

@igneel64
Copy link
Copy Markdown
Contributor

Add the tracker.getQueueName method.

This method will return the currently used queue name or if provided arguments will return the one that would be used with the provided eventMethod.

close #1215

@bundlemon
Copy link
Copy Markdown

bundlemon bot commented Jun 29, 2023

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+25.15KB 26KB / +10%
trackers/javascript-tracker/dist/sp.js
+24.09KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+14.76KB 15KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.63KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.35KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.46KB 5KB / +10%

Total files change +95.43KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Copy link
Copy Markdown
Contributor

@greg-el Greg Leonard (greg-el) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just a couple of thoughts I've had on the types.

I think I'm not properly following the types you've used here. I can see both:

  • 'post' | 'get' | undefined
  • Exclude<EventMethod, 'beacon'>

This seems to boil down to the same type, a potentially optional 'post' | 'get'. Could it be clearer to create a type alias for Exclude<EventMethod, 'beacon'>, which then could be used with ? as required?

/**
* Returns the currently used queue name or if the `eventMethod` argument is provided, the queue name for the eventMethod.
*/
getQueueName: (eventMethod?: 'post' | 'get' | undefined) => string;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This can be eventMethod?: 'post' | 'get' if you are using ?, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slipped in the PR, should be Exclude<EventMethod, 'beacon'> as in the implementation.

Copy link
Copy Markdown
Contributor

@jethron Jethro Nederhof (jethron) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

What's the intended use case here vs just a "clearQueue" method or similar? Does this encourage people to mess with the queue themselves? Or is this for like a plugin API?

Comment thread libraries/browser-tracker-core/src/tracker/out_queue.ts
Comment thread libraries/browser-tracker-core/src/tracker/out_queue.ts Outdated
Comment thread trackers/browser-tracker/test/tracker.test.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Expose localstorage queue name

3 participants