MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / ResourceSink

Function ResourceSink

source/binding/NodeJS/src/apis/callback.cpp:23–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void ResourceSink(void* resource, const char* message, const char* details_json, void* callback_arg)
24{
25 auto ctx = reinterpret_cast<maajs::CallbackContext*>(callback_arg);
26 ctx->Call<void>([=](maajs::FunctionType fn) {
27 auto res = ResourceImpl::locate_object(fn.Env(), reinterpret_cast<MaaResource*>(resource));
28 auto detail = maajs::JsonParse(fn.Env(), details_json).As<maajs::ObjectType>();
29 detail["msg"] = maajs::StringType::New(fn.Env(), RemovePrefix(message, "Resource."));
30 return fn.Call(
31 {
32 res,
33 detail,
34 });
35 });
36}
37
38void ControllerSink(void* controller, const char* message, const char* details_json, void* callback_arg)
39{

Callers

nothing calls this directly

Calls 4

JsonParseFunction · 0.85
RemovePrefixFunction · 0.85
EnvMethod · 0.45
CallMethod · 0.45

Tested by

no test coverage detected