migrating to js-maker
This commit is contained in:
+14
-3
@@ -30,6 +30,7 @@
|
|||||||
lru-cache
|
lru-cache
|
||||||
racket-self-signed-cert
|
racket-self-signed-cert
|
||||||
simple-log
|
simple-log
|
||||||
|
js-maker
|
||||||
)
|
)
|
||||||
|
|
||||||
(provide webview-new-context
|
(provide webview-new-context
|
||||||
@@ -396,6 +397,12 @@
|
|||||||
#f))
|
#f))
|
||||||
|
|
||||||
|
|
||||||
|
(define-syntax with-id->el
|
||||||
|
(syntax-rules ()
|
||||||
|
((_ id el e1 ...)
|
||||||
|
(js (let ((el (send document getElementById (eval id))))
|
||||||
|
e1 ...)))))
|
||||||
|
|
||||||
(define-syntax with-id
|
(define-syntax with-id
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
((_ id el
|
((_ id el
|
||||||
@@ -765,6 +772,7 @@
|
|||||||
|
|
||||||
(define/contract (webview-call-js wv js)
|
(define/contract (webview-call-js wv js)
|
||||||
(-> wv-win? string? (or/c string? list? boolean? hash? symbol? number?))
|
(-> wv-win? string? (or/c string? list? boolean? hash? symbol? number?))
|
||||||
|
(displayln js)
|
||||||
(let ((result (rkt-webview-call-js (wv-win-handle wv) js)))
|
(let ((result (rkt-webview-call-js (wv-win-handle wv) js)))
|
||||||
(if (webview-call-js-result? result)
|
(if (webview-call-js-result? result)
|
||||||
(if (eq? (car result) 'oke)
|
(if (eq? (car result) 'oke)
|
||||||
@@ -786,9 +794,12 @@
|
|||||||
(-> wv-win? symbol? (or/c string? xexpr?) symbol?)
|
(-> wv-win? symbol? (or/c string? xexpr?) symbol?)
|
||||||
(if (string? html)
|
(if (string? html)
|
||||||
(let ((r (webview-call-js wv
|
(let ((r (webview-call-js wv
|
||||||
(with-id id el
|
(with-id->el id el
|
||||||
("el.innerHTML = '~a'; return true;"
|
(set! (js-dot el innerHTML) (eval html))
|
||||||
(esc-quote html))))))
|
#t))))
|
||||||
|
;(with-id id el
|
||||||
|
; ("el.innerHTML = '~a'; return true;"
|
||||||
|
; (esc-quote html))))))
|
||||||
(if r 'oke 'failed))
|
(if r 'oke 'failed))
|
||||||
(webview-set-innerHTML! wv id (xexpr->string html))
|
(webview-set-innerHTML! wv id (xexpr->string html))
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user