ericmmartin / simplemodal

A modal dialog framework for jQuery
http://simplemodal.com/
Other
506 stars 229 forks source link

Passing in arbitrary values. #42

Open cnobile2012 opened 10 years ago

cnobile2012 commented 10 years ago

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