View "onStartup" script executing without waiting for parameters

The title sums it up pretty well. I have a "onStartup" script configured on a view.
This view is then embedded in a popup several times.
When the script executes, it needs to use two custom parameters that will be passed to it from the popup view.
My current issue is that my script executes without waiting for the parameters to be passed in. The script simply uses whatever default values are set on for the parameters, and that isn't very helpful when I need the custom parameters.
I tried adding a "sleep()" instruction to the top of the script, but of course the script seems to image variable values before executing. (Or sleep somehow temporarily stops the view from importing the new parameters, but I find this unlikely.)
If anyone has run into this before or if you have any ideas on how I can either delay the script, or load the values in time, I would appreciate it.
Thanks in advance,
Alex