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

Passing in arbitrary values. #42

Open
cnobile2012 opened this issue Oct 26, 2013 · 0 comments
Open

Passing in arbitrary values. #42

cnobile2012 opened this issue Oct 26, 2013 · 0 comments

Comments

@cnobile2012
Copy link

jQuery itself when binding a function/method to an object allows you to pass in arbitrary objects in the 2nd argument as in:

$('#someId').bind('click', {self: this}, this.method);

A method is then called like this:

event.data.self.anotherMethod(); This is an instance call.

The above is extremely useful when writing good OO code in JavaScript. I really don't like having to do the following, in my code:

ClassName.prototype.anotherMethod(); This is a static call.

This is very ugly in my opinion. I realize that JavaScript is not an OO language like Java or Python, etc, but I feel this is still a better option than a static call to the method.

So I guess what I am asking is, is it possible to allow something like this as an argument in your modal options for example?

Carl

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

1 participant