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 ArkUI 19 */ 20 21import { AsyncCallback } from '../@ohos.base'; 22import ExtensionContext from './ExtensionContext'; 23import Want from '../@ohos.application.Want'; 24import StartOptions from '../@ohos.app.ability.StartOptions'; 25 26/** 27 * The context of window extension. It allows access to 28 * windowExtension-specific resources. 29 * 30 * @extends ExtensionContext 31 * @syscap SystemCapability.WindowManager.WindowManager.Core 32 * @systemapi 33 * @stagemodelonly 34 * @since 9 35 */ 36export default class WindowExtensionContext extends ExtensionContext { 37 /** 38 * Window extension uses this method to start a specific ability. 39 * 40 * @param { Want } want - Indicates the ability to start. 41 * @param { StartOptions } options - Indicates the start options. 42 * @param { AsyncCallback<void> } callback - The callback of startAbility. 43 * @throws { BusinessError } 401 - Parameter error. Possible cause: 1.Mandatory parameters are left unspecified; 44 * 2.Incorrect parameter types. 45 * @syscap SystemCapability.WindowManager.WindowManager.Core 46 * @systemapi 47 * @stagemodelonly 48 * @since 9 49 */ 50 /** 51 * Window extension uses this method to start a specific ability. 52 * 53 * @param { Want } want - Indicates the ability to start. 54 * @param { StartOptions } options - Indicates the start options. 55 * @param { AsyncCallback<void> } callback - The callback of startAbility. 56 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 57 * @throws { BusinessError } 401 - Parameter error. Possible cause: 1.Mandatory parameters are left unspecified; 58 * 2.Incorrect parameter types. 59 * @syscap SystemCapability.WindowManager.WindowManager.Core 60 * @systemapi 61 * @stagemodelonly 62 * @since 12 63 */ 64 startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void; 65 66 /** 67 * Window extension uses this method to start a specific ability. 68 * 69 * @param { Want } want - Indicates the ability to start. 70 * @param { StartOptions } [options] - Indicates the start options. 71 * @returns { Promise<void> } The promise returned by the function. 72 * @throws { BusinessError } 401 - Parameter error. Possible cause: 1.Mandatory parameters are left unspecified; 73 * 2.Incorrect parameter types. 74 * @syscap SystemCapability.WindowManager.WindowManager.Core 75 * @systemapi 76 * @stagemodelonly 77 * @since 9 78 */ 79 /** 80 * Window extension uses this method to start a specific ability. 81 * 82 * @param { Want } want - Indicates the ability to start. 83 * @param { StartOptions } [options] - Indicates the start options. 84 * @returns { Promise<void> } The promise returned by the function. 85 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 86 * @throws { BusinessError } 401 - Parameter error. Possible cause: 1.Mandatory parameters are left unspecified; 87 * 2.Incorrect parameter types. 88 * @syscap SystemCapability.WindowManager.WindowManager.Core 89 * @systemapi 90 * @stagemodelonly 91 * @since 12 92 */ 93 startAbility(want: Want, options?: StartOptions): Promise<void>; 94} 95