From 61c5cf4246a8a03cc54339014016f21fefa19238 Mon Sep 17 00:00:00 2001 From: interp Date: Wed, 16 Apr 2003 16:01:01 +0000 Subject: [PATCH] Add CALLBACK-FUNCTOR that allows the call back arbitrary functions (in conjunction with make-annotated-callback) --- scheme/httpd/surflets/callbacks.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scheme/httpd/surflets/callbacks.scm b/scheme/httpd/surflets/callbacks.scm index ada7c8c..36037c5 100644 --- a/scheme/httpd/surflets/callbacks.scm +++ b/scheme/httpd/surflets/callbacks.scm @@ -1,5 +1,11 @@ ;; Copyright 2002, 2003 Andreas Bernauer +;; With callbacks you can create special links that are associated +;; with a function. If the user clicks on the special callback link, +;; the send-html/suspend won't return, but the function will be called +;; instead. Note: It is not sensible to create callbacks on top level, +;; as they contain continuations. You have to create a new callback +;; every time you want to use it (inside a function). (define (make-callback function) (call-with-current-continuation (lambda (exit) @@ -22,4 +28,8 @@ unexpected return values from website")))))) (callback (make-callback dispatch))) (lambda args - (annotated-address callback args)))) \ No newline at end of file + (annotated-address callback args)))) + +(define callback-functor + (lambda (req proc . args) + (apply proc (cons req args))))