kanaka/noVNC — pull request #201 by takaha (2012-10-15 11:05:45+00:00)
Title: Fix: IE9 leaves "ReferenceError: RFB is not defined"

This patch gives a workaround for https://github.com/kanaka/noVNC/issues/199 and https://github.com/kanaka/noVNC/issues/194 .

noVNC also runs well on IE9 with the patch:
- it is guaranteed that scripts are Initialized in register order.
- noVNC starts its service when catching a NoVnc.onload event, which is fired when all scripts are loaded and initialized.

This patch makes all script objects to catch its onload event to track the status of loading scripts. When it detects the completion of loading them, it starts to call the initialization routines of the scripts in register order. If there is a script named ABC.js and it depends on objects defined in other scripts to initialize itself, you should move this part into a initialization routine named _init_ABC(). This function is guaranteed to be called after the scripts it depends has been initialized.

There is a chance some scripts happen to require loading other scripts when initializing themselves. In this case, noVNC will wait for the completion of loading these scripts again and restart invoking initialization routines.

Once it detects all scripts are initialized, it fires a NoVnc.onload event.