$.extend({ myFunc : function(someArg, callbackFnk){ // do something here var data = 'test'; // now call a callback function if(typeof callbackFnk == 'function'){ callbackFnk.call(this, data); } }});$.myFunc(someArg, function(arg){ // now my function is not hardcoded // in the plugin itself // and arg = 'test'});
2More
JQuery HowTo: Create callback functions for your jQuery plugins & extensions - 1 views
1More