JQuery - Dangerous Challenge - Receive the parameter function

JQuery - Dangerous Challenge - Receive the parameter function

Guys,

This challenge is so dangerous to me. I developed a plugin for my company. It is as follows:

To call a plugin, simply enter the code below:

  1. $(this).validateAudience({module: 'specific', specific: 'dateAll["#id_name"]'});


In this plugin, the function model is thus:

  1.         $.fn.validateAudience = function(settings) {           
  2.                 if(settings) {
  3.                         try {
  4.                                 //currying - techniques javascript.
  5.                                 execute( add(settings));
  6.                                 return true;
  7.                         } catch(error) {
  8.                                 cancel(error.description);
  9.                         }
  10.                 } else {
  11.                         alert("Unable to call validateAudience. It's need specific parameter.");
  12.                 }
  13.         };


And the function execute() is as follows:

  1.         var execute = function(settings) {
  2.                 module[settings.module].apply( this, arguments);
  3.         }



Where in function "module", is thus:

  1.         var module = {
  2.                 specific: function(settings) {
  3.                         input[settings.specific].apply( this, arguments );
  4.                 }



Where the function "input", is thus:

  1.         var input = {
  2.                 dateAll: function(parameter) {
  3.                         /* this is where I want the function receives the parameter */
  4.                 },
  5.         }




Does anyone have any idea how to do that the function receives the parameter in dateAll informed from the first code on the screen, as below:

  1.          $(this).validateAudience({module: 'specific', specific: 'dateAll["#id_name"]'});
Anyway, for those who want to visualize the complete contents of the plugin I created for my company as follows: http://forum.imasters.uol.com.br/index.php?/topic/410831-jquery-desafio-perigoso-receber-o-parametro-na-funcao/

Thanks,
Vinicius - Brazil.