mirror of
https://github.com/srid/ema.git
synced 2024-11-25 20:12:20 +03:00
Re-evaluate script tags on reload (#45)
This commit is contained in:
parent
18a6acd41a
commit
66a679700a
@ -3,7 +3,9 @@
|
||||
## Unreleased (0.2.0.0)
|
||||
|
||||
- TODO(doc) runEma's action gets the `CLI.Action` as argument, to prevent the `gen` command from needing to monitoring files.
|
||||
- Handle invalid routes gracefully without breaking websocket
|
||||
- Live Server
|
||||
- Handle invalid routes gracefully without breaking websocket
|
||||
- Re-add `<script>` tags on hot reload
|
||||
- `Asset` type
|
||||
- Introduce the `Asset` type to distinguishing between static files and generated files. The later can be one of `Html` or `Other`, allowing the live server to handle them sensibly.
|
||||
- `Ema` typeclass:
|
||||
|
@ -198,7 +198,7 @@ wsClientShim =
|
||||
morphdom(elm, html);
|
||||
};
|
||||
|
||||
// FIXME: Can't make this work with tailwind shim
|
||||
// FIXME: This doesn't reliably work across all JS.
|
||||
function reloadScripts(elm) {
|
||||
Array.from(elm.querySelectorAll("script")).forEach(oldScript => {
|
||||
const newScript = document.createElement("script");
|
||||
@ -294,8 +294,8 @@ wsClientShim =
|
||||
document.location.href = evt.data.slice("REDIRECT ".length);
|
||||
} else {
|
||||
setHtml(document.documentElement, evt.data);
|
||||
reloadScripts(document.documentElement);
|
||||
window.scrollTo({ top: 0});
|
||||
// reloadScripts(document.documentElement);
|
||||
watchCurrentRoute();
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user