interface_sdk-js/api/@ohos.application.ServiceExtension.d.ts
zhongjianfei c53271a638 zhongjianfei@huawei.com
Signed-off-by: zhongjianfei <zhongjianfei@huawei.com>
Change-Id: Iaabcd22fc9a409965c78c6d2fc813f64c9bc2c5e
2022-01-10 11:12:24 +08:00

113 lines
3.4 KiB
TypeScript

/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rpc from "./@ohos.rpc";
import ServiceExtensionContext from "./application/ServiceExtensionContext";
import Want from './@ohos.application.Want';
/**
* class of service extension.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
*/
export default class ServiceExtension {
/**
* Indicates service extension context.
*
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
*/
context: ServiceExtensionContext;
/**
* Called back when a service extension is started for initialization.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
* @return -
*/
onCreate(want: Want): void;
/**
* Called back before a service extension is destroyed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
* @return -
*/
onDestroy(): void;
/**
* Called back when a service extension is started.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates the want of service extension to start.
* @param startId Indicates the number of times the service extension has been started. The {@code startId} is
* incremented by 1 every time the service extension is started. For example, if the service extension
* has been started for six times.
* @systemapi hide for inner use.
* @return -
*/
onRequest(want: Want, startId: number): void;
/**
* Called back when a service extension is first connected to an ability.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates connection information about the Service ability.
* @systemapi hide for inner use.
* @return Returns the proxy of the Service ability.
*/
onConnect(want: Want): rpc.RemoteObject;
/**
* Called back when all abilities connected to a service extension are disconnected.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates disconnection information about the service extension.
* @systemapi hide for inner use.
* @return -
*/
onDisconnect(want: Want): void;
/**
* Called when a new client attempts to connect to a service extension after all previous client connections to it
* are disconnected.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates the want of the service extension being connected.
* @systemapi hide for inner use.
* @return -
*/
onReconnect(want: Want): void;
}