diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-02-15 10:33:30 -0800 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-02-15 10:33:30 -0800 |
commit | ecb9fdd0719bd0087e3fe4f7e4a4717e93117d27 (patch) | |
tree | 0a3ae4f750730823345c248f065b65ce205f1104 | |
parent | e8cbb1b7609c3764a61d0965d556a84ee275413b (diff) | |
download | workbench-ecb9fdd0719bd0087e3fe4f7e4a4717e93117d27.tar.gz workbench-ecb9fdd0719bd0087e3fe4f7e4a4717e93117d27.tar.bz2 workbench-ecb9fdd0719bd0087e3fe4f7e4a4717e93117d27.zip |
fixed some stuff
-rw-r--r-- | package.scala | 4 | ||||
-rw-r--r-- | project/Build.scala | 6 | ||||
-rw-r--r-- | readme.md | 8 | ||||
-rw-r--r-- | workbench_template.ts | 4 |
4 files changed, 15 insertions, 7 deletions
diff --git a/package.scala b/package.scala index 9c989b0..d6cea03 100644 --- a/package.scala +++ b/package.scala @@ -1,4 +1,4 @@ -package scala.js +package scala.js.workbench import akka.actor.{Props, ActorRef, Actor, ActorSystem} import akka.io @@ -20,7 +20,7 @@ import spray.http.{StatusCodes, HttpResponse, HttpRequest} import spray.http.HttpHeaders.Connection import spray.can.server.websockets.model.OpCode.Text -package object workbench extends sbt.Plugin { +object Plugin extends sbt.Plugin { val refreshBrowsers = taskKey[Unit]("Sends a message to all connected web pages asking them to refresh the page") val updateBrowsers = taskKey[Unit]("partially resets some of the stuff in the browser") val generateClient = taskKey[File]("generates a .js file that can be embedded in your web page") diff --git a/project/Build.scala b/project/Build.scala index af554b6..e4227cd 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -10,6 +10,10 @@ object Build extends sbt.Build { Project("scala-js-workbench", file(".")) .dependsOn(uri("git://github.com/lihaoyi/SprayWebSockets.git")) .settings( + name := "scala-js-workbench", + version := "0.1-SNAPSHOT", + + organization := "com.lihaoyi.workbench", sbtPlugin := true, (resources in Compile) := {(resources in Compile).value ++ (baseDirectory.value * "*.ts").get}, resolvers += "spray repo" at "http://repo.spray.io", @@ -20,4 +24,4 @@ object Build extends sbt.Build { "com.typesafe.play" %% "play-json" % "2.2.0-RC1" ) ) -}
\ No newline at end of file +} @@ -19,9 +19,13 @@ To Use - Modify the `packageJS` task with the following setting, to make it generate the snippet of `workbench.js` file needed to communicate with SBT: ```scala +import scala.js.workbench.Plugin._ + +buildSettingsX + packageJS in Compile := { - (packageJS in Compile).value :+ scala.js.workbench.generateClient.value - } + (packageJS in Compile).value :+ scala.js.workbench.generateClient.value +} ``` - Define your `bootSnippet`, which is a piece of javascript to be run to start your application, e.g. `bootSnippet := "ScalaJS.modules.example_ScalaJSExample().main();"`. scala-js-workbench requires this so it can use it to re-start your application later on its own. You do not also need to include this on the page itself, as scala-js-workbench will execute this snippet when the browser first connects. diff --git a/workbench_template.ts b/workbench_template.ts index 7e49bab..c16d02b 100644 --- a/workbench_template.ts +++ b/workbench_template.ts @@ -3,7 +3,7 @@ var socket = (function(){ var shadowBody = null var bootSnippet = "<bootSnippet>" window.onload = function(){ - shadowBody = document.body.cloneNode() + shadowBody = document.body.cloneNode(true) } window.addEventListener("keydown", function (event) { if(event.keyCode==13 && event.ctrlKey && event.altKey && event.shiftKey) { @@ -12,7 +12,7 @@ var socket = (function(){ } }) function clear(){ - document.body = shadowBody.cloneNode() + document.body = shadowBody.cloneNode(true) for(var i = 0; i < 99999; i++){ clearTimeout(i) clearInterval(i) |