Use camel-case for deno js api.

This commit is contained in:
Ryan Dahl 2018-06-11 22:41:43 +02:00
parent 64d41a72f1
commit f89f576f6d
3 changed files with 11 additions and 11 deletions

View File

@ -214,15 +214,15 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
auto print_tmpl = v8::FunctionTemplate::New(isolate, Print);
auto print_val = print_tmpl->GetFunction(context).ToLocalChecked();
CHECK(
global->Set(context, deno::v8_str("deno_print"), print_val).FromJust());
global->Set(context, deno::v8_str("denoPrint"), print_val).FromJust());
auto sub_tmpl = v8::FunctionTemplate::New(isolate, Sub);
auto sub_val = sub_tmpl->GetFunction(context).ToLocalChecked();
CHECK(global->Set(context, deno::v8_str("deno_sub"), sub_val).FromJust());
CHECK(global->Set(context, deno::v8_str("denoSub"), sub_val).FromJust());
auto pub_tmpl = v8::FunctionTemplate::New(isolate, Pub);
auto pub_val = pub_tmpl->GetFunction(context).ToLocalChecked();
CHECK(global->Set(context, deno::v8_str("deno_pub"), pub_val).FromJust());
CHECK(global->Set(context, deno::v8_str("denoPub"), pub_val).FromJust());
bool r = Execute(context, js_filename, js_source);
assert(r);

View File

@ -1,6 +1,6 @@
const globalEval = eval;
const window = globalEval("this");
window["denoMain"] = () => {
deno_print("Hello world from foo");
denoPrint("Hello world from foo");
return "foo";
};

View File

@ -11,19 +11,19 @@ function typedArrayToArrayBuffer(ta) {
}
function CanCallFunction() {
deno_print("Hello world from foo");
denoPrint("Hello world from foo");
return "foo";
}
function PubSuccess() {
deno_sub((channel, msg) => {
denoSub((channel, msg) => {
assert(channel === "PubSuccess");
deno_print("PubSuccess: ok");
denoPrint("PubSuccess: ok");
});
}
function PubByteLength() {
deno_sub((channel, msg) => {
denoSub((channel, msg) => {
assert(channel === "PubByteLength");
assert(msg instanceof ArrayBuffer);
assert(msg.byteLength === 3);
@ -33,16 +33,16 @@ function PubByteLength() {
function SubReturnEmpty() {
const ui8 = new Uint8Array("abc".split("").map(c => c.charCodeAt(0)));
const ab = typedArrayToArrayBuffer(ui8);
let r = deno_pub("SubReturnEmpty", ab);
let r = denoPub("SubReturnEmpty", ab);
assert(r == null);
r = deno_pub("SubReturnEmpty", ab);
r = denoPub("SubReturnEmpty", ab);
assert(r == null);
}
function SubReturnBar() {
const ui8 = new Uint8Array("abc".split("").map(c => c.charCodeAt(0)));
const ab = typedArrayToArrayBuffer(ui8);
const r = deno_pub("SubReturnBar", ab);
const r = denoPub("SubReturnBar", ab);
assert(r instanceof ArrayBuffer);
assert(r.byteLength === 3);
const rui8 = new Uint8Array(r);