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

Allow translate.text to accept a string for callback in browser context #6

Open
erikvold opened this issue Jul 4, 2010 · 4 comments

Comments

@erikvold
Copy link
Contributor

erikvold commented Jul 4, 2010

In the browser context, it is slightly more efficient (depending on the use case) for a user of translate.js to pass a string as the callback, which is the name of the global function that will be used when the jsonp request is complete. Besides that it is a nice additional feature I think.

@Marak
Copy link
Owner

Marak commented Jul 4, 2010

efficient or succinct?

you'd have to show me the code, i dont really understand. if you are talking about event binding sugar syntax, i think thats the job for an event library, not translate

@erikvold
Copy link
Contributor Author

erikvold commented Jul 4, 2010

efficient or succinct?

efficient

you'd have to show me the code

patch

It didn't turn out as well as I hoped, because the returned variable is the full reponse in this case, and not just the translated text..

@Marak
Copy link
Owner

Marak commented Jul 4, 2010

yeah i see what you are talking about now.

this is a problem i think. if you fire two concurrent translate requests the callbacks are going to get borked?

this is why i wanted to use a standard JSONP / AJAX library for this. i might revert back to jQuery, since I know jQuery will automatically create the dynamic callback names for you.

@erikvold
Copy link
Contributor Author

erikvold commented Jul 4, 2010

this is a problem i think. if you fire two concurrent translate requests the callbacks are going to get borked?

I thought about that situation, and I can't see how this gets borked. A library would be overkill imo.

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