R
Randell D.
Folks,
I'm sure this can be done legally, and not thru tricks of the trade - I
hope someone can help.
I'm writing a 'tool' (a function) which can be used generically in any
of my projects. When it completes, it can call a success, or a failure
function. The names of these success, or failure functions will differ,
and I'd like to know how I can pass the name of a function to my tool,
and how my tool can call the function, using that name...
Roughly speaking I want to have something like
function my_engine(success_function_name, failure_function_name)
{
// Processing code here chews data
// Then...
if(myResult==true)
{ success_function_name(); }
else
{ failure_function_name(); }
}
Anybody got any ideas/suggestions? I'm sure there was a js method that
I could use but I can't find reference to it in my O'Reilly JavaScript
pocket reference...
All help, via the newsgroup (so all can learn) will be greatly appreciated,
Thanks,
Randell D.
I'm sure this can be done legally, and not thru tricks of the trade - I
hope someone can help.
I'm writing a 'tool' (a function) which can be used generically in any
of my projects. When it completes, it can call a success, or a failure
function. The names of these success, or failure functions will differ,
and I'd like to know how I can pass the name of a function to my tool,
and how my tool can call the function, using that name...
Roughly speaking I want to have something like
function my_engine(success_function_name, failure_function_name)
{
// Processing code here chews data
// Then...
if(myResult==true)
{ success_function_name(); }
else
{ failure_function_name(); }
}
Anybody got any ideas/suggestions? I'm sure there was a js method that
I could use but I can't find reference to it in my O'Reilly JavaScript
pocket reference...
All help, via the newsgroup (so all can learn) will be greatly appreciated,
Thanks,
Randell D.