creating delayed reactor

This commit is contained in:
2026-04-21 15:07:59 +02:00
parent 472c70660c
commit e44f51a772
2 changed files with 27 additions and 2 deletions

View File

@@ -1,3 +1,26 @@
body { body {
font-family: sans-serif; font-family: sans-serif;
} }
[tip] .tooltip {
position: fixed;
font-size: 16px;
line-height: 20px;
padding: 5px;
background: #444;
border: 1px solid #222;
visibility: hidden;
opacity: 0;
box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.2);
transition: opacity 0.3s, visibility 0s;
color: white;
min-width: 120px;
}
[tip]:hover .tooltip {
visibility: visible;
opacity: 1;
}

View File

@@ -1025,8 +1025,9 @@
;; delayed reactor ;; delayed reactor
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define/contract (webview-delayed-reactor seconds value-callback) (define/contract (webview-delayed-reactor seconds value-callback
(-> number? procedure? procedure?) #:update [update-callback (λ (val) #t)])
(->* (number? procedure?) (#:update procedure?) procedure?)
(let ((value-set-at -1) (let ((value-set-at -1)
(value 'none) (value 'none)
(wait-thread #f) (wait-thread #f)
@@ -1035,6 +1036,7 @@
(λ (val) (λ (val)
(set! value val) (set! value val)
(set! value-set-at (current-milliseconds)) (set! value-set-at (current-milliseconds))
(update-callback val)
(when (eq? wait-thread #f) (when (eq? wait-thread #f)
(set! wait-thread (thread (λ () (set! wait-thread (thread (λ ()
(let loop ((vsa value-set-at)) (let loop ((vsa value-set-at))