summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flexo.lisp33
1 files changed, 22 insertions, 11 deletions
diff --git a/flexo.lisp b/flexo.lisp
index e9369c3..bff77b0 100644
--- a/flexo.lisp
+++ b/flexo.lisp
@@ -36,6 +36,10 @@
(defun mark-autorefresh-true (directory)
(when *auto-refresh-key*
(alexandria:write-string-into-file
+ (auto-refresh-script-ps)
+ (format nil "~a/auto-refresh-script.js" directory)
+ :if-exists :supersede)
+ (alexandria:write-string-into-file
"true"
(format nil "~a/~a.json" directory *auto-refresh-key*)
:if-exists :supersede )))
@@ -43,6 +47,10 @@
(defun mark-autorefresh-false (directory)
(when *auto-refresh-key*
(alexandria:write-string-into-file
+ (auto-refresh-script-ps)
+ (format nil "~a/auto-refresh-script.js" directory)
+ :if-exists :supersede)
+ (alexandria:write-string-into-file
"false"
(format nil "~a/~a.json" directory *auto-refresh-key*)
:if-exists :supersede )))
@@ -62,17 +70,20 @@
(defun auto-refresh-script ()
(when *auto-refresh-key*
(with-html
- (:script
- (ps:ps
- (let ((poll-url (+ "/" (ps:lisp flexo::*auto-refresh-key*) ".json")))
- (set-interval
- (lambda ()
- (let ((fetched (fetch poll-url)))
- (ps:chain fetched
- (then (lambda (resp) (ps:chain resp (json))))
- (then (lambda (json)
- (when json (ps:chain location (reload))))))))
- 1000)))))))
+ (:script :src "/auto-refresh-script.js"))))
+
+(defun auto-refresh-script-ps ()
+ (ps:ps
+ (set-interval
+ (lambda ()
+ (let ((fetched
+ (fetch
+ (ps:lisp (format nil "/~a.json" flexo::*auto-refresh-key*)))))
+ (ps:chain fetched
+ (then (lambda (resp) (ps:chain resp (json))))
+ (then (lambda (json)
+ (when json (ps:chain location (reload))))))))
+ 1000)))
(defun table-subset-p (tab1 tab2 &key (test 'equal))
"TEST compares values"