Sync with JSON script injection completion

R

Richard Maher

Hi,

I'm pretty sure the answer is "No" but just in case: - "Is there anyway to
wait/synchronize my JavaScript code (after the head.appendChild(script))
until the newly injected script has completed?" I guess the browser does its
asynchronous HTTP thing and, if/when my original hard-wired function
returns, the user is free to click away while awaiting the results/callback
of my script injection. But then if I wasn't to surrender the EDT then maybe
the callback could never get called?

Like many similar situations in the browser I presume we just have to
lock-down/disable any offending user interaction with the likes of a
translucent <div> or a lot of .disabled=trues, but it's just that elsewhere
I've got this mega-sexy rendezvous() Applet method invoked from a JavaScript
callback that notifyAll()s a previous synchronous-send request's wait(), and
I was wondering if there was something similar lying around.

Cheers Richard Maher
 
J

Jorge

Hi,

I'm pretty sure the answer is "No" but just in case: - "Is there anyway to
wait/synchronize my JavaScript code (after the head.appendChild(script))
until the newly injected script has completed?" I guess the browser does its
asynchronous HTTP thing and, if/when my original hard-wired function
returns, the user is free to click away while awaiting the results/callback
of my script injection. But then if I wasn't to surrender the EDT then maybe
the callback could never get called?

What's the EDT ?
Like many similar situations in the browser I presume we just have to
lock-down/disable any offending user interaction with the likes of a
translucent <div> or a lot of .disabled=trues, but it's just that elsewhere
I've got this mega-sexy rendezvous() Applet method invoked from a JavaScript
callback that notifyAll()s a previous synchronous-send request's wait(), and
I was wondering if there was something similar lying around.

Ugly but quick and as effective would be a transient
document.body.style.display= "none";

Or use a global gUIDisabled= true; and insert this first line in your
UI-event-handlers: if (gUIDisabled) { peventDefault and
stopPropagation and return }
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top