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

missing var declaration on mixpanel-jslib-snippet.js #215

Closed
agustinhaller opened this issue Apr 9, 2019 · 2 comments
Closed

missing var declaration on mixpanel-jslib-snippet.js #215

agustinhaller opened this issue Apr 9, 2019 · 2 comments

Comments

@agustinhaller
Copy link

Hi, this is a simple one to fix.
I noticed there are a couple var declarations missing in the mixpanel-jslib-snippet.js file.

call2_args = arguments;
call2 = [fn_name].concat(Array.prototype.slice.call(call2_args, 0));

As I'm using the snippet source code to load mixpanel lib from my Typescript code asynchronously. The Typescript compiler is complaining about those missing var declarations.

If you wonder why I'm using the snippet code directly in my Typescript files, it's because I don't want to include the snippet in my index.html as I want to keep scripts in the index.html file to a minimum to avoid blocking the UI thread.
I think this approach is a nice workaround for this issue.

@tdumitrescu
Copy link
Member

Thanks for the catch! We'll get it in an upcoming release, though you can always expedite by submitting a PR.

Re: bundling the async loader ("snippet"): that's a workable approach as long as you ensure you always run that JS bundle before you ever try to access window.mixpanel. The minified snippet is designed to be small enough to put in a page's <head> tag without any noticeable delay, and then you don't have to worry about loading order at all. The issue being discussed in #128 is different: the problem there is the size of the actual library code, which will only affect you when you try to put the entire lib in your bundles (i.e. bypassing the async loader altogether).

@tdumitrescu
Copy link
Member

Sorry this slipped under the radar; it's been fixed in v2.45.0.

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

2 participants