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

Add context: parameter #63

Closed
gka opened this issue Jan 12, 2012 · 2 comments
Closed

Add context: parameter #63

gka opened this issue Jan 12, 2012 · 2 comments

Comments

@gka
Copy link

gka commented Jan 12, 2012

In jQuery one can assign a context to a ajax call, which comes in handy in some situations (eg when loading many assets at the same time)..

myObj = { foo: "bar" }
$.ajax({
    url: "...",
    context: myObj,
    success: function(c) {
         console.log(this.foo);
    }
});

Would be nice to have this option in reqwest, too.
What do you think?

@ded
Copy link
Owner

ded commented Jan 12, 2012

i think you'd be better off currying the function yourself rather than it being built-in. what's your general use-case?

@gka
Copy link
Author

gka commented Jan 12, 2012

maybe it's just that i got used to this api over the years, but currying myself is fine, too.

my general use case is that I often need to load several files at once. currently i'm writing a tiny ender extension for this functionality. because of the missing context option, I now had to include the Function.prototype.bind thing to ensure that the success handler is always bound to the right context.

but i'm sure there must be an easier way to do the same..

@gka gka closed this as completed Jan 12, 2012
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