java.lang.Object | ||||
↳ | sun.org.mozilla.javascript.internal.ScriptableObject | |||
↳ | sun.org.mozilla.javascript.internal.IdScriptableObject | |||
↳ | sun.org.mozilla.javascript.internal.ImporterTopLevel | |||
↳ | com.sun.script.javascript.RhinoTopLevel |
This class serves as top level scope for Rhino. This class adds 3 top level functions (bindings, scope, sync) and two constructors (JSAdapter, JavaAdapter).
[Expand]
Inherited Constants | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]()
|
[Expand]
Inherited Fields | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]()
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The bindings function takes a JavaScript scope object
of type ExternalScriptable and returns the underlying Bindings
instance.
| |||||||||||
The scope function creates a new JavaScript scope object
with given Bindings object as backing store.
| |||||||||||
The sync function creates a synchronized function (in the sense
of a Java synchronized method) from an existing function.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
The bindings function takes a JavaScript scope object of type ExternalScriptable and returns the underlying Bindings instance. var page = scope(pageBindings); with (page) { // code that uses page scope } var b = bindings(page); // operate on bindings here.
The scope function creates a new JavaScript scope object with given Bindings object as backing store. This can be used to create a script scope based on arbitrary Bindings instance. For example, in webapp scenario, a 'page' level Bindings instance may be wrapped as a scope and code can be run in JavaScripe 'with' statement: var page = scope(pageBindings); with (page) { // code that uses page scope }
The sync function creates a synchronized function (in the sense
of a Java synchronized method) from an existing function. The
new function synchronizes on the this
object of
its invocation.
js> var o = { f : sync(function(x) {
print("entry");
Packages.java.lang.Thread.sleep(x*1000);
print("exit");
})};
js> thread(function() {o.f(5);});
entry
js> thread(function() {o.f(5);});
js>
exit
entry
exit