How to reload a page in DukeScript

268 views Asked by At

DukeScript is quite clever in the way it handle changes to the Model so that code is hot-swapped at runtime, see for example here. One thing it doesn't seem to handle at Runtime though is changes to the HTML layout. Given it runs in a WebView, a kind of a browse, it would nice just to be able to reload the page without having to stop and restart the app.

So, I've tried adding a "reload" button, but I can't find an easy way to do that after the initialization:

BrowserBuilder
.newBrowser()
.loadPage("pages/index.html")
.loadClass(Main.class).
invoke("onPageLoad", args).
showAndWait();

showAndWait() does what it's supposed to do, it doesn't return until the browser is closed. There doesn't seem any way to act on the underlying instance of a WebView and its thread.

1

There are 1 answers

0
ZiglioUK On BEST ANSWER

Ha ha, simple but effective solution:

<a href="index.html">Reload</a>

Note: Toni Epple says NetBeans would just detect the change, no reload needed.