• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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 "../basic";
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 * @syscap SystemCapability.WindowManager.WindowManager.Core
25 * @systemapi
26 * @stagemodelonly
27 * @since 9
28 */
29export default class WindowExtensionContext extends ExtensionContext {
30    /**
31     * Window extension uses this method to start a specific ability.
32     * @param { Want } want - Indicates the ability to start.
33     * @param { StartOptions } options - Indicates the start options.
34     * @param { AsyncCallback<void> } callback - The callback of startAbility.
35     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
36     * @syscap SystemCapability.WindowManager.WindowManager.Core
37     * @systemapi
38     * @stagemodelonly
39     * @since 9
40     */
41    startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
42
43    /**
44     * Window extension uses this method to start a specific ability.
45     * @param { Want } want - Indicates the ability to start.
46     * @param { StartOptions } options - Indicates the start options.
47     * @returns { Promise<void> } The promise returned by the function.
48     * @throws { BusinessError } 401 - If the input parameter is not valid parameter.
49     * @syscap SystemCapability.WindowManager.WindowManager.Core
50     * @systemapi
51     * @stagemodelonly
52     * @since 9
53     */
54    startAbility(want: Want, options?: StartOptions): Promise<void>;
55}