0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-01 12:16:11 -05:00

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_tmpl = v8::FunctionTemplate::New(isolate, Print);
auto print_val = print_tmpl->GetFunction(context).ToLocalChecked(); auto print_val = print_tmpl->GetFunction(context).ToLocalChecked();
CHECK( 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_tmpl = v8::FunctionTemplate::New(isolate, Sub);
auto sub_val = sub_tmpl->GetFunction(context).ToLocalChecked(); 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_tmpl = v8::FunctionTemplate::New(isolate, Pub);
auto pub_val = pub_tmpl->GetFunction(context).ToLocalChecked(); 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); bool r = Execute(context, js_filename, js_source);
assert(r); assert(r);

View file

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

View file

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