[jQuery] currying in jquery.
All,
I have an object like:
p = {
......
click: function(target){
}
....
};
function curry(fn,s)
{
var scope = s || window;
var args = Array.prototype.slice.call(arguments, 2) || [];
return function()
{
fn.apply(scope, args);
};
}
I register events like:
$('.preview').click(function(){f=curry(preview.click,preview,$(this));f
();});
I am achiving the desired effect by the above line. I feel it the
above line loks ugly. Is there any other means of doing this?
TIA,
-Shiva