MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / TestGetSharedArrayBufferInfo

Function TestGetSharedArrayBufferInfo

test/shared_array_buffer.cc:41–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41Value TestGetSharedArrayBufferInfo(const CallbackInfo& info) {
42 if (info.Length() < 1) {
43 Error::New(info.Env(), "Wrong number of arguments")
44 .ThrowAsJavaScriptException();
45 return Value();
46 } else if (!info[0].IsSharedArrayBuffer()) {
47 Error::New(info.Env(),
48 "Wrong type of arguments. Expects a SharedArrayBuffer as first "
49 "argument.")
50 .ThrowAsJavaScriptException();
51 return Value();
52 }
53
54 auto byte_length = info[0].As<SharedArrayBuffer>().ByteLength();
55
56 return Number::New(info.Env(), byte_length);
57}
58
59Value TestSharedArrayBufferData(const CallbackInfo& info) {
60 if (info.Length() < 1) {

Callers

nothing calls this directly

Calls 5

LengthMethod · 0.80
EnvMethod · 0.80
ByteLengthMethod · 0.80
ValueClass · 0.50

Tested by

no test coverage detected