JavaScript Metaprogramming: Reduce boilerplate of adding functions to a function queue
- by thurn
I'm working with animation in JavaScript, and I have a bunch of functions you can call to add things to the animation queue. Basically, all of these functions look like this:
function foo(arg1, arg2) {
_eventQueue.push(function() {
// actual logic
}
}
I'm wondering now if it would be possible to cut down on this boilerplate a…