/ Published in: jQuery
Hi, all, this is the "checkFunction" extension for jQuery.
This extension takes two parameters:
1. fPointer
This parameter is the "possible" function to check
1.1 This parameter can be a String that is a function pointer
ex:"editUser"
1.2 This parameter can be a function
ex: function(idUser){alert('Edit User '+idUser);}
1.3 This parameter can be a String that is a function body
ex: "alert('Edit User');"
2. lastFpPointer
This parameter is the function by default if the fpPointer is not a valid function
2.1 This parameter must be a function
ex: function(){}
This extension makes possibles to get any possible representation of a function and detect if it exist.
If it exist return it like a correct function.
If doesn't exist the default function will be returned.
The use of this extension:
Examples:
- jQuery.checkFunction("EditUser", function(){});
returns EditUser
- jQuery.checkFunction("EditUser ();alert('Edit Launched');", function(){});
returns function(){EditUser ();alert('Edit Launched');}
- jQuery.checkFunction(EditUser, function(){});
returns EditUser
Thanks.
This extension takes two parameters:
1. fPointer
This parameter is the "possible" function to check
1.1 This parameter can be a String that is a function pointer
ex:"editUser"
1.2 This parameter can be a function
ex: function(idUser){alert('Edit User '+idUser);}
1.3 This parameter can be a String that is a function body
ex: "alert('Edit User');"
2. lastFpPointer
This parameter is the function by default if the fpPointer is not a valid function
2.1 This parameter must be a function
ex: function(){}
This extension makes possibles to get any possible representation of a function and detect if it exist.
If it exist return it like a correct function.
If doesn't exist the default function will be returned.
The use of this extension:
Examples:
- jQuery.checkFunction("EditUser", function(){});
returns EditUser
- jQuery.checkFunction("EditUser ();alert('Edit Launched');", function(){});
returns function(){EditUser ();alert('Edit Launched');}
- jQuery.checkFunction(EditUser, function(){});
returns EditUser
Thanks.