summaryrefslogtreecommitdiff
path: root/deno2/include
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-06-13 19:38:22 +0200
committerRyan Dahl <ry@tinyclouds.org>2018-06-14 14:19:17 +0200
commit4ac67cf3435b3e15f95fadc20c98e37abf706ea4 (patch)
tree651b18c568e6ca8130d3d37de60a6a44e12e855b /deno2/include
parentf97216609d1705a21ddbe6ca3efb04817f026fc3 (diff)
Demo protobufs in deno2.
Adds deno_set_response() to allow stack allocated responses.
Diffstat (limited to 'deno2/include')
-rw-r--r--deno2/include/deno.h8
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);