• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16import { AsyncCallback } from '../@ohos.base';
17import ExtensionContext from './ExtensionContext';
18import Want from '../@ohos.application.Want';
19import StartOptions from '../@ohos.app.ability.StartOptions';
20
21/**
22 * The context of window extension. It allows access to
23 * windowExtension-specific resources.
24 *
25 * @extends ExtensionContext
26 * @syscap SystemCapability.WindowManager.WindowManager.Core
27 * @systemapi
28 * @stagemodelonly
29 * @since 9
30 */
31export default class WindowExtensionContext extends ExtensionContext {
32  /**
33   * Window extension uses this method to start a specific ability.
34   *
35   * @param { Want } want - Indicates the ability to start.
36   * @param { StartOptions } options - Indicates the start options.
37   * @param { AsyncCallback<void> } callback - The callback of startAbility.
38   * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
39   * @syscap SystemCapability.WindowManager.WindowManager.Core
40   * @systemapi
41   * @stagemodelonly
42   * @since 9
43   */
44  startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
45
46  /**
47   * Window extension uses this method to start a specific ability.
48   *
49   * @param { Want } want - Indicates the ability to start.
50   * @param { StartOptions } [options] - Indicates the start options.
51   * @returns { Promise<void> } The promise returned by the function.
52   * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
53   * @syscap SystemCapability.WindowManager.WindowManager.Core
54   * @systemapi
55   * @stagemodelonly
56   * @since 9
57   */
58  startAbility(want: Want, options?: StartOptions): Promise<void>;
59}
60