File tree Expand file tree Collapse file tree
source/binding/NodeJS/src/apis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,11 +233,9 @@ maajs::PromiseType ControllerImpl::wait(MaaCtrlId id)
233233 return worker->Promise ();
234234}
235235
236- maajs::PromiseType ControllerImpl::get_connected ()
236+ bool ControllerImpl::get_connected ()
237237{
238- auto worker = new maajs::AsyncWork<MaaStatus>(env, [handle = controller]() { return MaaControllerConnected (handle); });
239- worker->Queue ();
240- return worker->Promise ();
238+ return MaaControllerConnected (controller);
241239}
242240
243241std::optional<maajs::ArrayBufferType> ControllerImpl::get_cached_image ()
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ declare global {
184184 clear ( ) : void
185185 status ( id : CtrlId ) : Status
186186 wait ( id : CtrlId ) : Promise < Status >
187- get connected ( ) : Promise < boolean >
187+ get connected ( ) : boolean
188188 get cached_image ( ) : ImageData | null
189189 get uuid ( ) : string | null
190190 get resolution ( ) : [ width : number , height : number ] | null
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ struct ControllerImpl : public maajs::NativeClassBase
6767 maajs::ValueType post_screencap (maajs::ValueType self, maajs::EnvType env);
6868 MaaStatus status (MaaCtrlId id);
6969 maajs::PromiseType wait (MaaCtrlId id);
70- maajs::PromiseType get_connected ();
70+ bool get_connected ();
7171 std::optional<maajs::ArrayBufferType> get_cached_image ();
7272 std::optional<std::string> get_uuid ();
7373 std::optional<std::tuple<int32_t , int32_t >> get_resolution ();
You can’t perform that action at this time.
0 commit comments