Skip to content

Using promises #230

Description

@shareefhadid

This package should really be using promises as most calls are asynchronous.

This wasn't made clear in the documentation, but I realized it when I performed an expensive operation and the connection closed before it could be completed.

For now I need to wrap the calls in promises myself and resolve/reject in the callback like so:

await new Promise((resolve, reject) => {
  mixpanel.people.set_once(identifier, data, (e) => {
    if (e) {
      reject(e);
    }

    resolve(null);
  });
}

Activity

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

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