Inheritance diagram for burst.runtime.AbstractRuntime:
Has both mandatory to implement methods and some that are implemented in this class.
The singleton instance is available from the static function burst.runtime.AbstractRuntime.getRuntime() which returns bu_Runtime
This interface includes such important matters as:
Note that differentiating among browsers is done in burst.web.UserAgent. This class is just for differentiating among whole environments, of which a browser is one.
(Note that maintainers must do more to add a new environment implementation than the methods defined here; in particular the constructor must implement isPresent()
and must be in burst.runtime.AbstractRuntime.ALL_CTORS.)
consider an abbreviated version that does no loading, just resolves and checks assertions
Public Member Functions | |
abstract String | name () |
Return an identifier for this environment, such as 'DOM' or 'SpiderMonkey'. | |
abstract String | version () |
Return the version string supplied by this environment. | |
abstract String | getBaseURI (String relpath) |
Return the base url of this library's installation. | |
abstract void | readEvalAsync (String url, Function done_handler) |
Read the contents of the specified url and execute it in the global scope. | |
abstract void | readEvalSync (String url) |
The synchronous version. | |
abstract void | getTextAsync (String url, Function handler, Boolean nocache) |
Fetch text contents at the specified url. | |
abstract void | getDocumentAsync (String url, Function handler) |
Fetch Document object at the specified url. | |
abstract | readEval (String url, Function done_handler) |
Convenience function, available from base class. | |
abstract void | println (String line) |
Print the provided line. | |
abstract void | exit (Number exitcode) |
Exit the whole process with the specified exit code. | |
abstract Boolean | has_HttpRequest () |
Whether the environment supports issuing http requests. |
|
Exit the whole process with the specified exit code. Optional to implement, but there is no default implementation. |
|
Return the base url of this library's installation. All script urls will be resolved with this base url prior to calling readEvalAsync or readEvalSync . The return value typically ends with '/'. Mandatory to implement.
|
|
Return an identifier for this environment, such as 'DOM' or 'SpiderMonkey'. Mandatory to implement. |
|
Print the provided line. The line does not itself contain an EOL; the callee should provide one. Optional to implement, but there is no default implementation. If the environment does not provide this, then there is no default destination for logging. |
|
Convenience function, available from base class. If readEvalAsync is available, use that and return null. Else if readEvalSync is available, use that and return the result of immediately calling done_handler. Otherwise throw. |
|
Read the contents of the specified url and execute it in the global scope. In a ECMAScript shell, this is typically done via a global load() function. In a browser, this is typically done via a dynamically created script element. This interface does not mandate a completion handler. The caller should expect that in general the implementation may finish asynchronously, though it may choose to actually be synchronous if it likes. If there are errors (in reading, parsing, or execution) they are expected to be thrown. The only urls that must be accepted are ones in the same origin as the library itself, and in fact it is expected that urls from any other origin will probably fail. This means for example that in a shell the url is a relative or absolute local file. In a browser, it would be 'http:' or 'ftp:' or 'file:' or whatever the library is loading as. At least one of readEvalAsync or readEvalSync is mandatory to implement. Implemented in burst.runtime.DomRuntime. |
|
The synchronous version. There is no requirement that the result of the eval be returned, but it might. Implemented in burst.runtime.RhinoRuntime, burst.runtime.SpiderMonkeyRuntime, and burst.runtime.WshRuntime. |
|
Return the version string supplied by this environment. This is the version of its software, not the ECMAScript version it implements. Optional to implement; a default implementation returns null. |