Return the dom and store as a js global so it doesn't get gc'd
This commit is contained in:
parent
b8c368aeb4
commit
b093d804c8
2 changed files with 4 additions and 4 deletions
2
scene.js
2
scene.js
|
@ -1,6 +1,6 @@
|
|||
window.addEventListener("load", async () => {
|
||||
try {
|
||||
await Scheme.load_main("scene.wasm", {
|
||||
hootDom = await Scheme.load_main("scene.wasm", {
|
||||
user_imports: {
|
||||
document: {
|
||||
getElementById(id) {
|
||||
|
|
|
@ -118,9 +118,7 @@
|
|||
(button (@ (id "button")
|
||||
(type "button")
|
||||
(click ,(lambda (e)
|
||||
(! counter (1+ (! counter)))
|
||||
;; Hacky hack to ensure root-ref isn't GC'd too early...
|
||||
(display root-ref))))
|
||||
(! counter (1+ (! counter))))))
|
||||
"Counter: "
|
||||
,counter)
|
||||
(button (@ (click ,(lambda (e) (! counter 0))))
|
||||
|
@ -134,3 +132,5 @@
|
|||
`(p "I want to see " ,(~ (- 20 (! counter))) " more")))))
|
||||
|
||||
(append-child! (document-body) (element-ref-element root-ref))
|
||||
|
||||
root-ref
|
||||
|
|
Loading…
Reference in a new issue