Skip to content

init loaded callback not always called. #394

@arenoir

Description

@arenoir

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');
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions