Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

burst.runtime.DomRuntime Class Reference

Inheritance diagram for burst.runtime.DomRuntime:

burst.runtime.AbstractRuntime List of all members.

Detailed Description

Singleton subclass of AbstractRuntime for a browser environment (or wherever there is a DOM).


Static Public Member Functions

void readEvalAsync (String url, Function done_handler)
 Load a script by dynamically creating a 'script' element.


Member Function Documentation

void burst.runtime.DomRuntime.readEvalAsync String  url,
Function  done_handler
[static, virtual]
 

Load a script by dynamically creating a 'script' element.

If called before the current document has finished loading, it performs a document.write of a 'script' element. If called after the current document has finished loading, it does a el = document.createElement('script'); ... document.documentElement.appendChild(el) .

As written, this function has no provision for error handling (for example, an evaluation error in the loaded script). That might be done through an onerror on the current window.

When supported by the browser, we implement completion notification by setting an onload value on the script element. Otherwise it is implemented by simply creating another script element with inline content.

  • after calling this, also do a document.write('<script>done()</script>')

For some discussion, see Richard Cornford: http://groups.google.com/groups?selm=b4ocfi%24c5g%241%248300dec7%40news.demon.co.uk

Todo:
Find a way for browsers other than Mozilla to have a done_handler called.
Parameters:
url Relative or absolute url. If relative, it is relative to the document.
done_handler Optional Function to call when the script is done loading.

Implements burst.runtime.AbstractRuntime.


The documentation for this class was generated from the following file:
Generated on Tue Nov 30 04:03:09 2004 for BurstProject by doxygen 1.3.4