summaryrefslogtreecommitdiff
path: root/doc/api.texi
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-08-24 14:19:44 -0400
committerDavid Thompson <dthompson2@worcester.edu>2020-08-25 08:52:25 -0400
commitaba0801bf1c874e20d2698be8a3929ac6e29560a (patch)
treea32667057389f076dd706b0d0f74431b89c549d5 /doc/api.texi
parentc6ead0aeb6b2ab78d7d77907b2180dea98dcb473 (diff)
scripting: Add custom polling support.
Diffstat (limited to 'doc/api.texi')
-rw-r--r--doc/api.texi20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/api.texi b/doc/api.texi
index 9cfa26a..446460e 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -3985,6 +3985,15 @@ Schedule @var{body} to be evaluated every @var{interval} amount of
time. Repeat this @var{n} times, or indefinitely if not specified.
@end deffn
+It is also possible to schedule things that are not dependent on how
+much time passes. The agenda will periodically poll to see if any
+registered conditions are met.
+
+@deffn {Procedure} call-when pred thunk
+Call @var{thunk} sometime in the future when @var{pred} is satisfied
+(returns a value other than @code{#f}.)
+@end deffn
+
@node Scripts
@subsection Scripts
@@ -4070,6 +4079,17 @@ procedure @var{handler}.
Wait @var{duration} before resuming the current script.
@end deffn
+@deffn {Syntax} wait-until condition
+Wait until @var{condition} is met before resuming the current script.
+
+@example
+(script
+ (wait-until (key-pressed? 'z))
+ (display "you pressed the Z key!\n"))
+@end example
+
+@end deffn
+
@deffn {Syntax} forever body @dots{}
Evaluate @var{body} in an endless loop.
@end deffn