From aba0801bf1c874e20d2698be8a3929ac6e29560a Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 24 Aug 2020 14:19:44 -0400 Subject: scripting: Add custom polling support. --- doc/api.texi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'doc') 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 -- cgit v1.2.3