Skip to content

Commit

Permalink
feat: nodejs update for #441
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-para committed Dec 5, 2024
1 parent 5d309df commit f281eea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/binding/NodeJS/release/maa-node/src/maa.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export declare function tasker_post_pipeline(
export declare function tasker_status(handle: TaskerHandle, task_id: TaskId): Status
export declare function tasker_wait(handle: TaskerHandle, task_id: TaskId): Promise<Status>
export declare function tasker_running(handle: TaskerHandle): boolean
export declare function tasker_post_stop(handle: TaskerHandle): boolean
export declare function tasker_post_stop(handle: TaskerHandle): TaskId
export declare function tasker_get_resource(handle: TaskerHandle): ResourceHandle | null
export declare function tasker_get_controller(handle: TaskerHandle): ControllerHandle | null
export declare function tasker_clear_cache(handle: TaskerHandle): boolean
Expand Down
8 changes: 5 additions & 3 deletions source/binding/NodeJS/release/maa-node/src/tasker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ export class TaskerBase {
}

post_stop() {
if (!maa.tasker_post_stop(this.handle)) {
throw 'Tasker post_stop failed'
}
return new TaskJob(
this,
this.#source,
maa.tasker_post_stop(this.handle)
)
}

get resource() {
Expand Down
2 changes: 1 addition & 1 deletion source/binding/NodeJS/src/instance/tasker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool tasker_running(Napi::External<TaskerInfo> info)
return MaaTaskerRunning(info.Data()->handle);
}

bool tasker_post_stop(Napi::External<TaskerInfo> info)
MaaTaskId tasker_post_stop(Napi::External<TaskerInfo> info)
{
return MaaTaskerPostStop(info.Data()->handle);
}
Expand Down

0 comments on commit f281eea

Please sign in to comment.