Using a variable to define an event listener.

Using a variable to define an event listener.

Hello,

I've developed an edit-in-place plugin that I'm presently expanding upon to handle data types other than varchar/blob. Relatedly, I'd like to add the ability to specify what event the plugin should listen for (double click to edit, click to edit, hover to edit, etc)

I've attempted this:

  1.  var defaults = { 
  2.    eventType:'dblclick',


   //etc


and then...
  1. function editInPlace(thisObj){
  2.   $(thisObj).unbind(opts.eventType).opts.eventType(function(e){
  3.     makeEditable(thisObj); 
  4.     return false;
  5.   });
  6. };

Not that I expected this to work, mind you :]

My guess is I need to wrap an eval() around the whole shootin' match, but I've read numerous articles citing performance concerns regarding eval(), largely related to Dean Edwards' packer.

Two questions:

1] Would the eval() approach even work as expected? Is there an alternative aside from a ton of conditionals?
2] Are the performance concerns negligible on such a small-scale?