• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 * Defines XComponentController
18 * @since 8
19 */
20declare class XComponentController {
21  /**
22   * constructor.
23   * @since 8
24   */
25  constructor();
26
27  /**
28   * get the id of surface created by XComponent.
29   * @since 8
30   * @systemapi
31   */
32  getXComponentSurfaceId(): string;
33
34  /**
35   * get the context of native XComponent.
36   * @since 8
37   */
38  getXComponentContext(): Object;
39
40  /**
41   * set the surface size created by XComponent.
42   * @since 8
43   * @systemapi
44   */
45  setXComponentSurfaceSize(value: {
46    surfaceWidth: number;
47    surfaceHeight: number;
48  }): void;
49}
50
51/**
52 * Defines XComponent.
53 * @since 8
54 */
55interface XComponentInterface {
56  /**
57   * Constructor parameters
58   * @since 8
59   */
60  (value: { id: string; type: string; libraryname?: string; controller?: XComponentController }): XComponentAttribute;
61}
62
63/**
64 * Defines XComponentAttribute.
65 * @since 8
66 */
67declare class XComponentAttribute extends CommonMethod<XComponentAttribute> {
68  /**
69   * Called when judging whether the xcomponent surface is created.
70   * @since 8
71   */
72  onLoad(callback: (event?: object) => void): XComponentAttribute;
73
74  /**
75   * Called when judging whether the xcomponent is destroyed.
76   * @since 8
77   */
78  onDestroy(event: () => void): XComponentAttribute;
79}
80
81declare const XComponent: XComponentInterface;
82declare const XComponentInstance: XComponentAttribute;
83