I want to know that when spa has been loaded, I dynamically create a script, that contains a piece of code. Since I want to use the results executed in script in the code, I need to find out at which stage the code in the dynamically created script is crammed into the main thread for execution.