Skip to content

Commit 4896576

Browse files
committed
Revert "fix(js): custom controller connected dead lock"
This reverts commit f5d1706.
1 parent 2dab1a1 commit 4896576

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

source/binding/NodeJS/src/apis/controller.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff 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

243241
std::optional<maajs::ArrayBufferType> ControllerImpl::get_cached_image()

source/binding/NodeJS/src/apis/controller.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

source/binding/NodeJS/src/apis/controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)