Package org.cometd.javascript
Class JavaScript
java.lang.Object
org.cometd.javascript.JavaScript
- All Implemented Interfaces:
java.lang.Runnable
public class JavaScript
extends java.lang.Object
implements java.lang.Runnable
-
Constructor Summary
Constructors Constructor Description JavaScript() -
Method Summary
Modifier and Type Method Description org.graalvm.polyglot.Valuebindings()voiddestroy()<T> Tevaluate(java.lang.String name, java.lang.String code)<T> Tevaluate(java.net.URL url)<T> Tget(java.lang.String key)voidinit()<T> Tinvoke(boolean sync, java.lang.Object jsThis, java.lang.Object function, java.lang.Object... arguments)voidput(java.lang.String key, java.lang.Object value)voidrun()java.util.concurrent.ScheduledFuture<?>schedule(java.lang.Object jsThis, java.lang.Object function, long delay)Invoked frombrowser.js.java.util.concurrent.ScheduledFuture<?>scheduleWithFixedDelay(java.lang.Object jsThis, java.lang.Object function, long initialDelay, long delay)Invoked frombrowser.js.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JavaScript
public JavaScript()
-
-
Method Details
-
bindings
public org.graalvm.polyglot.Value bindings() -
init
public void init() -
destroy
public void destroy() throws java.lang.Exception- Throws:
java.lang.Exception
-
run
public void run()- Specified by:
runin interfacejava.lang.Runnable
-
invoke
public <T> T invoke(boolean sync, java.lang.Object jsThis, java.lang.Object function, java.lang.Object... arguments) -
evaluate
public <T> T evaluate(java.net.URL url) -
evaluate
public <T> T evaluate(java.lang.String name, java.lang.String code) -
get
public <T> T get(java.lang.String key) -
put
public void put(java.lang.String key, java.lang.Object value) -
schedule
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Object jsThis, java.lang.Object function, long delay)Invoked frombrowser.js.- Parameters:
jsThis- the JavaScriptthisreferencefunction- the function to invoke after the given delaydelay- the delay after which the function is invoked, in milliseconds- Returns:
- a task representing the scheduled execution
-
scheduleWithFixedDelay
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Object jsThis, java.lang.Object function, long initialDelay, long delay)Invoked frombrowser.js.- Parameters:
jsThis- the JavaScriptthisreferencefunction- the function to invoke after the given delayinitialDelay- the delay of the first execution, in millisecondsdelay- the delay after which the function is invoked, in milliseconds- Returns:
- a task representing the scheduled execution
-