summaryrefslogtreecommitdiff
path: root/core/libdeno
diff options
context:
space:
mode:
Diffstat (limited to 'core/libdeno')
-rw-r--r--core/libdeno/api.cc8
-rw-r--r--core/libdeno/deno.h8
-rw-r--r--core/libdeno/libdeno.d.ts7
-rw-r--r--core/libdeno/libdeno_test.cc2
4 files changed, 10 insertions, 15 deletions
diff --git a/core/libdeno/api.cc b/core/libdeno/api.cc
index 30f82b6cc..8a3a56156 100644
--- a/core/libdeno/api.cc
+++ b/core/libdeno/api.cc
@@ -153,15 +153,11 @@ void deno_pinned_buf_delete(deno_pinned_buf* buf) {
auto _ = deno::PinnedBuf(buf);
}
-void deno_respond(Deno* d_, void* user_data, deno_buf buf, int* promise_id) {
+void deno_respond(Deno* d_, void* user_data, deno_buf buf) {
auto* d = unwrap(d_);
if (d->current_args_ != nullptr) {
// Synchronous response.
- if (promise_id != nullptr) {
- auto number = v8::Number::New(d->isolate_, *promise_id);
- d->current_args_->GetReturnValue().Set(number);
- } else {
- CHECK_NOT_NULL(buf.data_ptr);
+ if (buf.data_ptr != nullptr) {
auto ab = deno::ImportBuf(d, buf);
d->current_args_->GetReturnValue().Set(ab);
}
diff --git a/core/libdeno/deno.h b/core/libdeno/deno.h
index 4f29f2c7a..745285554 100644
--- a/core/libdeno/deno.h
+++ b/core/libdeno/deno.h
@@ -81,10 +81,8 @@ void deno_execute(Deno* d, void* user_data, const char* js_filename,
// deno_respond sends up to one message back for every deno_recv_cb made.
//
// If this is called during deno_recv_cb, the issuing libdeno.send() in
-// javascript will synchronously return the specified promise_id(number)
-// or buf(Uint8Array) (or null if buf and promise_id are both null/empty).
-// Calling with non-null for both buf and promise_id will result in the
-// promise_id being returned.
+// javascript will synchronously return the specified buf as an ArrayBuffer (or
+// null if buf is empty).
//
// If this is called after deno_recv_cb has returned, the deno_respond
// will call into the JS callback specified by libdeno.recv().
@@ -94,7 +92,7 @@ void deno_execute(Deno* d, void* user_data, const char* js_filename,
// releasing its memory.)
//
// If a JS exception was encountered, deno_last_exception() will be non-NULL.
-void deno_respond(Deno* d, void* user_data, deno_buf buf, int* promise_id);
+void deno_respond(Deno* d, void* user_data, deno_buf buf);
// consumes zero_copy
void deno_pinned_buf_delete(deno_pinned_buf* buf);
diff --git a/core/libdeno/libdeno.d.ts b/core/libdeno/libdeno.d.ts
index 093e846ab..1bc7367d9 100644
--- a/core/libdeno/libdeno.d.ts
+++ b/core/libdeno/libdeno.d.ts
@@ -12,13 +12,14 @@ interface EvalErrorInfo {
thrown: any;
}
-declare type MessageCallbackInternal = (msg: Uint8Array) => void;
+declare interface MessageCallback {
+ (msg: Uint8Array): void;
+}
declare interface DenoCore {
- recv(cb: MessageCallbackInternal): void;
+ recv(cb: MessageCallback): void;
send(
- cmdId: number,
control: null | ArrayBufferView,
data?: ArrayBufferView
): null | Uint8Array;
diff --git a/core/libdeno/libdeno_test.cc b/core/libdeno/libdeno_test.cc
index b72a8e098..485c95bff 100644
--- a/core/libdeno/libdeno_test.cc
+++ b/core/libdeno/libdeno_test.cc
@@ -75,7 +75,7 @@ TEST(LibDenoTest, RecvReturnBar) {
EXPECT_EQ(buf.data_ptr[1], 'b');
EXPECT_EQ(buf.data_ptr[2], 'c');
uint8_t response[] = {'b', 'a', 'r'};
- deno_respond(d, user_data, {response, sizeof response}, nullptr);
+ deno_respond(d, user_data, {response, sizeof response});
};
Deno* d = deno_new(deno_config{0, snapshot, empty, recv_cb, nullptr});
deno_execute(d, d, "a.js", "RecvReturnBar()");