From 2cfa7614b54d95ebc5fb5422955588385bb63bcd Mon Sep 17 00:00:00 2001 From: lihaoyi Date: Thu, 21 Nov 2013 00:07:31 -0800 Subject: Added the ability to manually reset the browser via a javascript shortcut --- readme.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 6ba3f3c..e428f38 100644 --- a/readme.md +++ b/readme.md @@ -24,7 +24,7 @@ packageJS in Compile := { } ``` -- Define your `bootstrapSnippet`, which is a piece of javascript to be run to start your application, e.g. `bootstrapSnippet := "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. +- 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. Now you have a choice of what you want to do when the code compiles: @@ -42,7 +42,8 @@ This will attempt to perform an update without refreshing the page every time `p - Returning the state of `document.body` to the initial state before any javascript was run - Stripping all event listeners from things within body -- Clearing all repeated timeouts and intervals. +- Clearing all repeated timeouts and intervals +- Running the `bootSnippet` again `updateBrowsers` is a best-effort cleanup, and does not do things like: @@ -52,6 +53,8 @@ This will attempt to perform an update without refreshing the page every time `p Nonetheless, for the bulk of javascript libraries these limitations are acceptable. As long as you're not doing anything too crazy, `updateBrowsers` but should suffice for most applications. +You can force the clean-up-and-reboot to happen from the browser via the shortcut Ctrl-Alt-Shift-Enter if you simply wish to reset the browser to a clean state. + ------- With that done, when you open a HTML page containing `workbench.js`, if you have sbt running and scala-js-workbench enabled, it should connect over websockets and start forwarding our SBT log to the browser javascript console. You can now run the `refreshBrowsers` and `updateBrowsers` commands to tell it to refresh itself, and if you set up the `triggeredBy` rule as shown above, it should refresh/update itself automatically at the end of every `packageJS` cycle. -- cgit v1.2.3