Skip to content

Conversation

@alexs-mparticle
Copy link
Collaborator

Instructions

  1. PR target branch should be against development
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

  • Adds a listener to Core SDK that kits can use to publish their ready status for subscribers.

Testing Plan

  • Was this tested locally? If not, explain why.
  • Use a sample app (Ideally React or an SPA) to publish and subscribe ready status.

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

);
if (!forwarder.initialized) {
mpInstance._preInit.kitListeners[forwarder.id] = {
isInitialized: true,
Copy link
Member

Choose a reason for hiding this comment

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

can prob remove

Suggested change
isInitialized: true,

return {};
}
};
// Used by our forwarders
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// 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) {
Copy link
Member

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

Comment on lines +1273 to +1278
const kitListener = self._preInit.kitListeners[moduleId];

if (!kitListener) {
self.Logger.error('Kit listener not found for moduleId: ' + moduleId);
return;
}
Copy link
Member

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

Copy link
Collaborator Author

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

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
16.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants