鸿蒙HarmonyOS应用开发之使用扩展的Node-API接口在异步线程中运行和停止事件循环_鸿蒙系统运行node服务器
创始人
2025-01-17 04:33:06
0

napi_value theFunc = nullptr;
if (napi_get_named_property(env, promise, “then”, &theFunc) != napi_ok) {
return nullptr;
}

napi_value resolvedCallback = nullptr;
napi_value rejectedCallback = nullptr;
napi_create_function(env, “resolvedCallback”, NAPI_AUTO_LENGTH, ResolvedCallback, nullptr, &resolvedCallback);
napi_create_function(env, “rejectedCallback”, NAPI_AUTO_LENGTH, RejectedCallback, nullptr, &rejectedCallback);
napi_value argv[2] = {resolvedCallback, rejectedCallback};
napi_call_function(env, promise, theFunc, 2, argv, nullptr);

auto flag = reinterpret_cast(arg);
if (*flag == true) {
napi_run_event_loop(env, napi_event_mode_default);
} else {
// 非阻塞式的处理任务,有可能队列中还没有任务就已经返回了
napi_run_event_loop(env, napi_event_mode_nowait);
}
return nullptr;
}

static napi_value RunEventLoo

相关内容

热门资讯

透视计算!aapoker透视插... 透视计算!aapoker透视插件,aapoker透视方法,必胜教程(有挂辅助)1、让任何用户在无需a...
透视新版!aapoker ai... 透视新版!aapoker ai插件,aapoker怎么设置抽水,力荐教程(有挂介绍);aapoker...
透视有挂!aapoker脚本,... 透视有挂!aapoker脚本,aapoker透视脚本,德州教程(有挂规律)aapoker透视脚本辅助...
透视规律!aa poker辅助... 透视规律!aa poker辅助,aapoker脚本怎么用,必赢教程(有挂细节)1.aapoker脚本...
透视系统!aapoker辅助怎... 透视系统!aapoker辅助怎么用,aapoker辅助器怎么用,可靠教程(有挂细节);透视系统!aa...
透视教学!aapoker透视脚... 透视教学!aapoker透视脚本下载,aapoker辅助怎么用,wpk教程(有挂解密);1、金币登录...
透视讲解!aapoker透视方... 透视讲解!aapoker透视方法,aapoker插件下载,可靠教程(有挂方法)1、上手简单,内置详细...
透视讲解!aapoker万能辅... 透视讲解!aapoker万能辅助器,aapoker怎么选牌,扑克教程(有挂规律)1、aapoker万...
透视神器!aapoker插件下... 透视神器!aapoker插件下载,aapoker透视脚本下载,揭秘教程(有挂解说)1、aapoker...
透视工具!aapoker透视脚... 透视工具!aapoker透视脚本下载,aapoker辅助器是真的吗,微扑克教程(有挂攻略);1、打开...