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 16/** 17 * @syscap SystemCapability.BundleManager.BundleFramework 18 * @since 3 19 */ 20export interface CheckPackageHasInstalledResponse { 21 /** 22 * Whether the application exists, or whether the native application has been installed. 23 * @syscap SystemCapability.BundleManager.BundleFramework 24 * @since 3 25 */ 26 result: boolean; 27} 28 29/** 30 * @syscap SystemCapability.BundleManager.BundleFramework 31 * @since 3 32 */ 33export interface CheckPackageHasInstalledOptions { 34 /** 35 * Application bundle name. 36 * @syscap SystemCapability.BundleManager.BundleFramework 37 * @since 3 38 */ 39 bundleName: string; 40 41 /** 42 * Called when native applications are installed. 43 * @syscap SystemCapability.BundleManager.BundleFramework 44 * @since 3 45 */ 46 success?: (data: CheckPackageHasInstalledResponse) => void; 47 48 /** 49 * Called when native applications fail to be installed. 50 * @syscap SystemCapability.BundleManager.BundleFramework 51 * @since 3 52 */ 53 fail?: (data: any, code: number) => void; 54 55 /** 56 * Called when the excution is completed. 57 * @syscap SystemCapability.BundleManager.BundleFramework 58 * @since 3 59 */ 60 complete?: () => void; 61} 62 63/** 64 * @syscap SystemCapability.BundleManager.BundleFramework 65 * @since 3 66 * @import package from '@system.package'; 67 */ 68export default class Package { 69 /** 70 * Checks whethers an application exists, or whether a native application has been installed. 71 * @param options Options 72 * @syscap SystemCapability.BundleManager.BundleFramework 73 */ 74 static hasInstalled(options: CheckPackageHasInstalledOptions): void; 75}