michaelcarter / mixpanel-data-export-js

Mixpanel data export js
91 stars 38 forks source link

Allow multiple simultaneous callbacks #4

Closed marcusstenbeck closed 10 years ago

marcusstenbeck commented 10 years ago

I ran into trouble when making multiple request simultaneously. The callback was overwritten with each call, thus resulting in each request executing the code currently in the window.mpSuccess() function.

Currently I've solved it by appending a random number to the callback function name. This solution might not be the best, but it's a start.

michaelcarter commented 10 years ago

Seems like a sensible change, one small question there. :grinning:

marcusstenbeck commented 10 years ago

It might not be needed, I just wanted to make sure we don't accidentally get the same name twice. I'll make a little change to avoid using the while loop.

marcusstenbeck commented 10 years ago

Updated and went for a counter instead of a random seed. I must've been tired yesterday when I wrote that code. ;)