diff options
Diffstat (limited to 'deno2/include')
-rw-r--r-- | deno2/include/deno.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/deno2/include/deno.h b/deno2/include/deno.h index 3c42abd72..72318677a 100644 --- a/deno2/include/deno.h +++ b/deno2/include/deno.h @@ -19,8 +19,7 @@ typedef struct deno_s Deno; // A callback to receive a message from deno_pub javascript call. // buf is valid only for the lifetime of the call. -// The returned deno_buf is returned from deno_pub in javascript. -typedef deno_buf (*deno_sub_cb)(Deno* d, const char* channel, deno_buf buf); +typedef void (*deno_sub_cb)(Deno* d, const char* channel, deno_buf buf); void deno_init(); const char* deno_v8_version(); @@ -37,6 +36,11 @@ bool deno_execute(Deno* d, const char* js_filename, const char* js_source); // value indicates error. Check deno_last_exception() for exception text. bool deno_pub(Deno* d, const char* channel, deno_buf buf); +// Call this inside a deno_sub_cb to respond synchronously to messages. +// If this is not called during the life time of a deno_sub_cb callback +// the denoPub() call in javascript will return null. +void deno_set_response(Deno* d, deno_buf buf); + const char* deno_last_exception(Deno* d); void deno_terminate_execution(Deno* d); |