MCPcopy Create free account
hub / github.com/NativeScript/android / SetMethod

Function SetMethod

test-app/runtime/src/main/cpp/Util.cpp:159–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157 }
158
159 void SetMethod(Local <v8::Context> context,
160 Local <v8::Object> that,
161 const char *name,
162 v8::FunctionCallback callback,
163 Local <v8::Value> data) {
164 Isolate *isolate = context->GetIsolate();
165 Local<v8::Function> function =
166 NewFunctionTemplate(isolate,
167 callback,
168 data,
169 Local<v8::Signature>(),
170 v8::ConstructorBehavior::kThrow,
171 v8::SideEffectType::kHasSideEffect)
172 ->GetFunction(context)
173 .ToLocalChecked();
174 // kInternalized strings are created in the old space.
175 const v8::NewStringType type = v8::NewStringType::kInternalized;
176 Local<v8::String> name_string =
177 v8::String::NewFromUtf8(isolate, name, type).ToLocalChecked();
178 that->Set(context, name_string, function).Check();
179 function->SetName(name_string); // NODE_SET_METHOD() compatibility.
180 }
181
182 void SetMethod(v8::Isolate *isolate,
183 v8::Local<v8::Template> that,

Callers 1

InitMethod · 0.85

Calls 6

NewFunctionTemplateFunction · 0.85
ToLocalCheckedMethod · 0.80
GetFunctionMethod · 0.80
GetIsolateMethod · 0.45
CheckMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected