I want to :
- wait until a function A is defined (it's in a file loaded asynchronusly)
- then run function B
and i'd like to create a generic wrapper for that, so that i can directly make something like
waitFor(functionToWait, functionToExecute)
- i have a result for part 1 & 2, but it's based on setTimeout/setInterval, but i'd like to know if there would be a more elegant way (something like a watcher on the waited function)
- and i have no idea on the second part, especially how to use a string parameter to convert it into a function reference.
Thanks