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

Uncaught ReferenceError: callbackName is not defined #31

Open
332065255 opened this issue Apr 3, 2018 · 4 comments
Open

Uncaught ReferenceError: callbackName is not defined #31

332065255 opened this issue Apr 3, 2018 · 4 comments

Comments

@332065255
Copy link

经常会出这个问题,偶现性

@marcalexiei
Copy link
Contributor

Could you please provide more information about this issue?

E.g. Browser / code example

@marcalexiei
Copy link
Contributor

Maybe are you sending multiple call at once with the same callbackName?

superagent.get('exampleURL')
      .use(superagentJSONP({ callbackParam: 'jsonp', callbackName: 'myCallbackName', timeout: 10000 }))
      .end(function(err, res){
        console.info(err, res)
      });

superagent.get('exampleURL')
      .use(superagentJSONP({ callbackParam: 'jsonp', callbackName: 'myCallbackName', timeout: 10000 }))
      .end(function(err, res){
        console.info(err, res)
      });

superagent.get('exampleURL')
      .use(superagentJSONP({ callbackParam: 'jsonp', callbackName: 'myCallbackName', timeout: 10000 }))
      .end(function(err, res){
        console.info(err, res)
      });

The plugin cancel callbackName window function after the request is ended.
If you use the same name on parallel calls only the first call will found the function stored in window.

@jamesakers
Copy link

I had the same issue, specifying the timeout worked me. The callback is being removed from window before it is called. Specifying the timeout option wasn't necessary in the prior version I was using. For a baseline, the response times range from 60ms to 150ms in my use case.

@ceremcem
Copy link

I had the same issue, providing .use(jsonp({timeout: 10000})) solved the issue. Thanks.

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

4 participants