summaryrefslogtreecommitdiff
path: root/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala
diff options
context:
space:
mode:
authorHaoyi Li <haoyi@haoyi-mbp.corp.dropbox.com>2014-11-26 00:45:31 -0800
committerHaoyi Li <haoyi@haoyi-mbp.corp.dropbox.com>2014-11-26 00:45:31 -0800
commit2c4b142503bd2d871e6818b5cab8c38627d9e4a0 (patch)
tree6ba33d2980a1a7a1286100202a695c6631bd240e /tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala
downloadhands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.tar.gz
hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.tar.bz2
hands-on-scala-js-2c4b142503bd2d871e6818b5cab8c38627d9e4a0.zip
Squashed 'examples/scala-js/' content from commit 47311ba
git-subtree-dir: examples/scala-js git-subtree-split: 47311ba693f949f204f27ea9475bb63425fbd4f3
Diffstat (limited to 'tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala')
-rw-r--r--tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala b/tools/shared/src/main/scala/scala/scalajs/tools/env/ComJSRunner.scala
new file mode 100644
index 0000000..44302b8
--- /dev/null
+++ b/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
+
+}