I have an IIFE in my code, where there are few other IIFEs. All of them have names (so they aren't anonymous). I want to invoke some of IIFE later (i mean, yes they do their job at the beginning, but i want use them later), by other function. Like in example:
(function start()
{
/* some code*/
(function firstIIFE(param1, param2)
{
if (param1 && param2)
{
console.log('param1 ',param1, 'param2 ',param2);
return;
}
/* some code done when IIFE originally was self-invoked */
}(param1, param2));
/* some code */
}());
function foo()
{
start.firstIIFE(param1, param2);
}
Is it possible, to invoke (firstIIFE
) IIFE later? Because i want this function to do some things with param1
and param2
(which i created after those IIFE was invoked)?
Currently i got error like: Uncaught ReferenceError: param1 is not defined