Skip to content
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

init loaded callback not always called. #394

Open
arenoir opened this issue Oct 17, 2023 · 0 comments
Open

init loaded callback not always called. #394

arenoir opened this issue Oct 17, 2023 · 0 comments

Comments

@arenoir
Copy link

arenoir commented Oct 17, 2023

What would cause the loaded callback not to fire? Is there a error callback that we can hook into? The loaded callback runs half the time the other half it is never called. Any help is greatly appreciated. Thanks

"mixpanel-browser": "^2.47.0",

import mixpanel from 'mixpanel-browser';

export default class MixpanelService {
  constructor(token) {
    this.mpInstance = new Promise(
      (resolve) => {
        mixpanel.init(token, { loaded: resolve });
      }
    );
}

The test:

  test('mixpanel service asynchronously initializes a mixpanel instance', async function (assert) {
    const service = new MixpanelService('token');
    
    await service.mpInstance;
    
    const id = service.mpInstance.get_distinct_id()
    
    assert.equal(typeof id, 'string');
  });
arenoir added a commit to arenoir/mixpanel-js that referenced this issue Oct 14, 2024
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

No branches or pull requests

1 participant