init loaded callback not always called.
Opened this issue · 0 comments
arenoir commented
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');
});