add interface for LongTask
add LongTask and terminateTask

Signed-off-by: huangfeijie <huangfeijie@huawei.com>
This commit is contained in:
huangfeijie 2024-02-26 21:30:22 +08:00
parent c04f773a22
commit 05eafc68e0

View File

@ -559,6 +559,18 @@ declare namespace taskpool {
execute(task: Task): Promise<Object>;
}
/**
* The LongTask class provides an interface to create a task that has no upper limit on execution time.
*
* @extends Task
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
class LongTask extends Task {
}
/**
* The State defines the task state.
*
@ -1043,6 +1055,18 @@ declare namespace taskpool {
* @since 11
*/
function getTaskPoolInfo(): TaskPoolInfo;
/**
* Terminate a long task.
*
* @param { LongTask } longTask - The long task want to terminate.
* @throws { BusinessError } 401 - The input parameters are invalid.
* @syscap SystemCapability.Utils.Lang
* @crossplatform
* @atomicservice
* @since 12
*/
function terminateTask(longTask: LongTask): void;
}
export default taskpool;