• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2020 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 * @devices tv, phone, tablet, wearable
18 */
19export interface CheckPackageHasInstalledResponse {
20  /**
21   * Whether the application exists, or whether the native application has been installed.
22   * @devices tv, phone, tablet, wearable
23   * @since 3
24   */
25  result: boolean;
26}
27
28export interface CheckPackageHasInstalledOptions {
29  /**
30   * Application bundle name.
31   * @devices tv, phone, tablet, wearable
32   * @since 3
33   */
34  bundleName: string;
35
36  /**
37   * Called when native applications are installed.
38   * @devices tv, phone, tablet, wearable
39   * @since 3
40   */
41  success?: (data: CheckPackageHasInstalledResponse) => void;
42
43  /**
44   * Called when native applications fail to be installed.
45   * @devices tv, phone, tablet, wearable
46   * @since 3
47   */
48  fail?: (data: any, code: number) => void;
49
50  /**
51   * Called when the execution is completed.
52   * @devices tv, phone, tablet, wearable
53   * @since 3
54   */
55  complete?: () => void;
56}
57
58/**
59 * @devices tv, phone, tablet, wearable
60 */
61export default class Package {
62  /**
63   * Checks whether an application exists, or whether a native application has been installed.
64   * @param options Options.
65   * @devices tv, phone, tablet, wearable
66   */
67  static hasInstalled(options: CheckPackageHasInstalledOptions): void;
68}
69