Allow to pass arguments to task
piranna opened this issue · comments
At
Line 101 in 1eee814
name
that will be passed as arguments to the call of the task when executed. This would allow to pass it parameters without needing to use nested functions and get them from closures.This would require a complete different API and internal implementation. Passing a nested function is not a big deal (not even at perf level) so this is just a cosmetic thing IMHO.
My main concern is about being name
optional, that makes things more difficult to understand and do, otherwise implementation is trivial, just a matter of calling task.apply()
. Regarding performance, I don't have numbers, but definitely it introduce a penaly since the task
function objects needs to be created each time instead of just only once, consuming CPU and memory until garbage-collected (that was the reason why other functions like setTimeout()
allow to pass parameters after the timeout value).