Can you pass parameters to a function without invoking it right away?
javascript, jquery, promise
Solution
Why not
pipeHandler([function() { function1('value'); }, function2]);
?
This is where anonymous functions shine. If you spend some time working in Javascript, you'll probably encounter the same problem when using setTimeOut at some point.
Problem
I need to feed a `pipe()` handler function a bunch of function names so it can execute them in order, waiting for completion of each as it goes. This is great when those functions don't need parameters passing, but when parameters are needed I can't figure out how to pass them without the function going ahead and invoking itself (caused by the brackets). For example, this is what I typically pass: `pipeHandler([function1, function2]);` It'll then invoke `function1()` and `function2()` before the promise is completed. Where it gets difficult is when I want to do something like thiss: `pipeHandler([function1('value'), function2]);` That causes function1() to invoke immediately, completely bypassing the promise mechanism. In case it helps, this is the handler function: ``` function pipeHandler(requiredFunctions) { //Execute first required function var executeFunctions = requiredFunctions[0](); //Execute each subsequent required function using pipe() for ( var index = 1; index < requiredFunctions.length; index++ ) { executeFunctions = executeFunctions.pipe(requiredFunctions[index]); } //Execute allDone() using pipe() executeFunctions = executeFunctions.pipe(allDone); } ``` Hope somebody has an idea!