blob: f9a14344fbe6f03e6ac64f17a3ef0dcfb38bd360 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
}
|