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

Method dispatch_resource_sink

source/binding/NodeJS/src/plugin/runtime.cpp:223–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223void QuickJSRuntime::dispatch_resource_sink(MaaResource* handle, const char* message, const char* details_json)
224{
225 std::promise<void> promise;
226 std::future<void> future = promise.get_future();
227 d_->push_task([&promise, handle, message, details_json, &sinks = d_->plugin_resource_sinks](JSContext*) {
228 // TODO: 这里实际上在串行执行所有sink,逻辑上用Promise.all并行会更好,但是复用的sink函数已经阻塞了。
229 for (const auto& sink : sinks) {
230 sink(handle, message, details_json);
231 }
232 promise.set_value();
233 });
234 return future.get();
235}
236
237void QuickJSRuntime::dispatch_controller_sink(MaaController* handle, const char* message, const char* details_json)
238{

Callers 1

OnResourceEventFunction · 0.80

Calls 2

push_taskMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected