summaryrefslogtreecommitdiff
path: root/shared/main/scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-09-05 14:17:29 -0700
committerLi Haoyi <haoyi@dropbox.com>2014-09-05 14:17:29 -0700
commitb9624be0c341ad070869497d2d10db0bb6beb3ed (patch)
treeee6e5ee7b7c07248acbf9b6f97911d6541c72572 /shared/main/scala
parentfa3b7505ee26c4db0abbe72a4139ea4dafaaad60 (diff)
downloadworkbench-b9624be0c341ad070869497d2d10db0bb6beb3ed.tar.gz
workbench-b9624be0c341ad070869497d2d10db0bb6beb3ed.tar.bz2
workbench-b9624be0c341ad070869497d2d10db0bb6beb3ed.zip
0.2.0
Diffstat (limited to 'shared/main/scala')
-rw-r--r--shared/main/scala/workbench/Shared.scala30
1 files changed, 30 insertions, 0 deletions
diff --git a/shared/main/scala/workbench/Shared.scala b/shared/main/scala/workbench/Shared.scala
index da202b4..f9a1434 100644
--- a/shared/main/scala/workbench/Shared.scala
+++ b/shared/main/scala/workbench/Shared.scala
@@ -1,8 +1,38 @@
package com.lihaoyi.workbench
+import upickle.{Js, Reader, Writer}
+
+/**
+ * A standard way to read and write `Js.Value`s with autowire/upickle
+ */
+trait ReadWrite{
+ def write[Result: Writer](r: Result) = upickle.writeJs(r)
+ def read[Result: Reader](p: Js.Value) = upickle.readJs[Result](p)
+}
+
+/**
+ * Shared API between the workbench server and the workbench client,
+ * comprising methods the server can call on the client to make it do
+ * things
+ */
trait Api{
+ /**
+ * Reset the HTML page to its initial state
+ */
def clear(): Unit
+ /**
+ * Reload the entire webpage
+ */
def reload(): Unit
+
+ /**
+ * Print a `msg` with the given logging `level`
+ */
def print(level: String, msg: String): Unit
+
+ /**
+ * Execute the javascript file available at the given `path`. Optionally,
+ * run a `bootSnippet` after the file has been executed.
+ */
def run(path: String, bootSnippet: Option[String]): Unit
} \ No newline at end of file