-
Notifications
You must be signed in to change notification settings - Fork 57
feat: Add listeners for signaling when kit is ready #992
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
Conversation
src/forwarders.js
Outdated
| ); | ||
| if (!forwarder.initialized) { | ||
| mpInstance._preInit.kitListeners[forwarder.id] = { | ||
| isInitialized: true, |
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.
can prob remove
| isInitialized: true, |
src/mp-instance.ts
Outdated
| return {}; | ||
| } | ||
| }; | ||
| // Used by our forwarders |
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.
| // Used by our forwarders | |
| // addForwarder is called by each individual mp kit | |
| // kitready is called by each individual mp kit | |
| // onKitReady is called by the partner who is importing mparticle |
| } | ||
| }; | ||
| // Used by our forwarders | ||
| this.onKitReady = function(moduleId, callback) { |
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.
queue this if isInitialized is false
| const kitListener = self._preInit.kitListeners[moduleId]; | ||
|
|
||
| if (!kitListener) { | ||
| self.Logger.error('Kit listener not found for moduleId: ' + moduleId); | ||
| return; | ||
| } |
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.
I would DRY this with a method so that it's a helper function
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.
I think that work should be done as part of https://go.mparticle.com/work/SQDSDKS-4475
|


Instructions
developmentSummary
Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)