to successfully call a function with parameters by setTimeout, it needs to be a function that will be called by setTimeout internally. this patch actually enables multiple tries for calling the setState function.
These files really should be in the capa module, but we don't have a way to load js from there at the moment. (TODO)