summaryrefslogtreecommitdiff
path: root/examples/scala-js/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala
diff options
context:
space:
mode:
Diffstat (limited to 'examples/scala-js/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala')
-rw-r--r--examples/scala-js/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/scala-js/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala b/examples/scala-js/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala
new file mode 100644
index 0000000..44302b8
--- /dev/null
+++ b/examples/scala-js/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala
@@ -0,0 +1,22 @@
+package scala.scalajs.tools.env
+
+trait ComJSRunner extends AsyncJSRunner {
+
+ /** Send a message to the JS VM. Throws if the message cannot be sent. */
+ def send(msg: String): Unit
+
+ /** Block until a message is received. Throws a [[ComClosedExcpetion]]
+ * if the channel is closed before a message is received.
+ */
+ def receive(): String
+
+ /** Close the communication channel. Allows the VM to terminate if it is
+ * still waiting for callback. The JVM side **must** call close in
+ * order to be able to expect termination of the VM.
+ *
+ * Calling [[stop]] on a [ComJSRunner]] automatically closes the
+ * channel.
+ */
+ def close(): Unit
+
+}