diff options
author | lihaoyi <haoyi.sg@gmail.com> | 2013-11-21 00:07:31 -0800 |
---|---|---|
committer | lihaoyi <haoyi.sg@gmail.com> | 2013-11-21 00:07:31 -0800 |
commit | 2cfa7614b54d95ebc5fb5422955588385bb63bcd (patch) | |
tree | 483cdfa760b61ca8fe4bab04312860370105dd3f /readme.md | |
parent | 95b105d4f574286e8c9f445009617bbab11dab6b (diff) | |
download | workbench-2cfa7614b54d95ebc5fb5422955588385bb63bcd.tar.gz workbench-2cfa7614b54d95ebc5fb5422955588385bb63bcd.tar.bz2 workbench-2cfa7614b54d95ebc5fb5422955588385bb63bcd.zip |
Added the ability to manually reset the browser via a javascript shortcut
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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. |