We have a JQuery plugin that scans for attributed instructions and does some internal wire up of routines. We would like to allow content owners to provide us with a Name of a method that matches a predefined signature which we will call within our process at the appropriate time.
At design time you might normally do something like this:
myplugin.callback = function (){ /* Do stuff */ }
We want the caller to describe the reference and we will scan it and set things up once the DOM is ready. Something like the following:
Content owner defines their intent
<div callback="MyMethodName">
We find the instruction and then attach it to the required callback point in our plugin
var methodRef = ?????;
myplugin.callback = methodRef
Is there a mechanism in JQuery to find a method by its name/signature and create an invokable reference to it?