1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BackgroundTasksKit 19 */ 20 21import workScheduler from './@ohos.resourceschedule.workScheduler'; 22import _WorkSchedulerExtensionContext from './application/WorkSchedulerExtensionContext'; 23 24/** 25 * The context of work scheduler extension. It allows access to 26 * WorkSchedulerExtensionContext-specific resources. 27 * 28 * @typedef { _WorkSchedulerExtensionContext } 29 * @syscap SystemCapability.ResourceSchedule.WorkScheduler 30 * @StageModelOnly 31 * @since 10 32 */ 33export type WorkSchedulerExtensionContext = _WorkSchedulerExtensionContext; 34 35/** 36 * Class of the work scheduler extension ability. 37 * 38 * @syscap SystemCapability.ResourceSchedule.WorkScheduler 39 * @since 9 40 */ 41declare class WorkSchedulerExtensionAbility { 42 /** 43 * Indicates work scheduler extension ability context. 44 * 45 * @type { WorkSchedulerExtensionContext } 46 * @syscap SystemCapability.ResourceSchedule.WorkScheduler 47 * @StageModelOnly 48 * @since 10 49 */ 50 context: WorkSchedulerExtensionContext; 51 52 /** 53 * Called back when a work is started. 54 * 55 * @param {workScheduler.WorkInfo} work - The info of work. 56 * @syscap SystemCapability.ResourceSchedule.WorkScheduler 57 * @StageModelOnly 58 * @since 9 59 */ 60 onWorkStart(work: workScheduler.WorkInfo): void; 61 62 /** 63 * Called back when a work is stopped. 64 * 65 * @param {workScheduler.WorkInfo} work - The info of work. 66 * @syscap SystemCapability.ResourceSchedule.WorkScheduler 67 * @StageModelOnly 68 * @since 9 69 */ 70 onWorkStop(work: workScheduler.WorkInfo): void; 71} 72 73/** 74 * Class of the work scheduler extension ability. 75 * 76 * @syscap SystemCapability.ResourceSchedule.WorkScheduler 77 * @StageModelOnly 78 * @since 9 79 */ 80export default WorkSchedulerExtensionAbility;