Originally Posted by felgall
Presumably there is more code than what you posted and the tool array is being defined somewhere in the rest of the code.
From just the portion of code you supplied we can say that tool[ev.type] can be either a function or code that returns a function.
link to source is on first post
yes tool is defined + instanced previously, but I don't get the whole idea of why tool[ev.type] is an array