##// END OF EJS Templates
WAIT with async
naryl -
r24:2cc68984 default
parent child Browse files
Show More
@@ -1,7 +1,9 b''
1 1
2 * Use async/await
2 * Use Parenscript's packages
3 3 * Use Parenscript's minifier
4 * WAIT and MENU with async/await
4 * Remove dots
5 * MENU with async/await
6 * Find a way to minify syntax (extra returns at least)
5 7 * Special locations
6 8 * Special variables
7 9 * CLI build for Linux
@@ -24,6 +24,9 b''
24 24 (defm (root api report-error) (text)
25 25 (alert text))
26 26
27 (defm (root api sleep) (msec)
28 (ps:new (*promise (ps:=> resolve (set-timeout resolve msec)))))
29
27 30 (defm (root api init-dom) ()
28 31 ;; Save/load buttons
29 32 (let ((btn (document.get-element-by-id "qsp-btn-save")))
@@ -147,6 +147,9 b''
147 147
148 148 ;;; 20time
149 149
150 (ps:defpsmacro wait (msec)
151 `(await (api-call sleep ,msec)))
152
150 153 (ps:defpsmacro settimer (interval)
151 154 `(api-call set-timer ,interval))
152 155
@@ -274,12 +274,6 b''
274 274
275 275 ;;; 20time
276 276
277 ;; I wonder if there's a better solution than busy-wait
278 (defm (root lib wait) (msec)
279 (let* ((now (ps:new (*date)))
280 (exit-time (+ (funcall now.get-time) msec)))
281 (loop :while (< (funcall now.get-time) exit-time))))
282
283 277 (defm (root lib msecscount) ()
284 278 (- (*date.now) (root started-at)))
285 279
@@ -64,7 +64,7 b''
64 64
65 65 (ps:defpsmacro location ((name) &body body)
66 66 `(setf (root locs ,name)
67 (lambda (args)
67 (ps:async-lambda (args)
68 68 (label-block ()
69 69 (api-call init-args args)
70 70 ,@body
General Comments 0
You need to be logged in to leave comments. Login now