Package cn.nukkit.plugin.js
Class JSWorker
java.lang.Object
cn.nukkit.plugin.js.JSWorker
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
ConstructorDescriptionJSWorker
(org.graalvm.polyglot.Context sourceContext, ESMFileSystem fileSystem, String workerSourcePath) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
org.graalvm.polyglot.Value
org.graalvm.polyglot.Value
void
init()
org.graalvm.polyglot.Value
postMessage
(org.graalvm.polyglot.Value... arguments) postMessageAsync
(org.graalvm.polyglot.Value... arguments) void
setSourceReceiveCallback
(org.graalvm.polyglot.Value value) void
setWorkerReceiveCallback
(org.graalvm.polyglot.Value value) void
start()
-
Constructor Details
-
JSWorker
public JSWorker(org.graalvm.polyglot.Context sourceContext, ESMFileSystem fileSystem, String workerSourcePath)
-
-
Method Details
-
init
- Throws:
IOException
-
start
public void start() -
setSourceReceiveCallback
public void setSourceReceiveCallback(org.graalvm.polyglot.Value value) -
setWorkerReceiveCallback
public void setWorkerReceiveCallback(org.graalvm.polyglot.Value value) -
getSourceReceiveCallback
public org.graalvm.polyglot.Value getSourceReceiveCallback() -
getWorkerReceiveCallback
public org.graalvm.polyglot.Value getWorkerReceiveCallback() -
postMessage
public org.graalvm.polyglot.Value postMessage(org.graalvm.polyglot.Value... arguments) -
postMessageAsync
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-