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

'callback is not defined' in strict mode #92

Open
iamgoodbytes opened this issue Feb 10, 2017 · 1 comment
Open

'callback is not defined' in strict mode #92

iamgoodbytes opened this issue Feb 10, 2017 · 1 comment
Assignees
Labels

Comments

@iamgoodbytes
Copy link

iamgoodbytes commented Feb 10, 2017

Hi! I'm not sure if this is something that should be fixed in push.js or on my side but here it goes:

I was using rollupjs to bundle a module that uses push.js. This triggers an error in strict mode:

index.js:386 Uncaught (in promise) ReferenceError: callback is not defined

Here's where my browser is complaining:
https://github.com/Nickersoft/push.js/blob/master/push.js#L369

My understanding is that callback could be declared as a var (when doing so, I get rid of the error). I'm not completely sure what's causing this to happen, because when I use push.js directly, I don't get the error.

Here's a gist of what rollup is doing and where the browser throws the error:
https://gist.github.com/iamgoodbytes/2308eca55ea8ec86d3ee55ba13503ed0#file-gistfile1-txt-L386

UPDATE: disabling strict mode in rollup solved this for me, maybe someone can clarify why callback needs to be undeclared in push.js? I'm sure I'm missing something.

Thanks for the clarification and for the amazing library!

@Nickersoft
Copy link
Owner

Hmm.. I can look into it, but at first glance it seems the callback declaration is missing a var, which is not allowed in strict mode. What I should probably do is add back that var and add a 'use strict' at the top of the file. Thanks for bringing it to my attention and thanks for using Push!

@Nickersoft Nickersoft self-assigned this Jun 8, 2017
@Nickersoft Nickersoft added the P3 label Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants