mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-03-05 15:58:25 +00:00
Add ConnectServiceExtension.
Signed-off-by: dy_study <dingyao5@huawei.com> Change-Id: I1c2f34d021e6e5d5ddf11720300feabc117ee641
This commit is contained in:
parent
46f8576193
commit
3c4211ddaa
4
api/application/ServiceExtensionContext.d.ts
vendored
4
api/application/ServiceExtensionContext.d.ts
vendored
@ -1047,7 +1047,7 @@ export default class ServiceExtensionContext extends ExtensionContext {
|
||||
connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
|
||||
|
||||
/**
|
||||
* Disconnect an ability to a service extension, in contrast to {@link connectAbility}.
|
||||
* Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
|
||||
*
|
||||
* @param { number } connection - the connection id returned from connectAbility api.
|
||||
* @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
|
||||
@ -1062,7 +1062,7 @@ export default class ServiceExtensionContext extends ExtensionContext {
|
||||
disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Disconnect an ability to a service extension, in contrast to {@link connectAbility}.
|
||||
* Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
|
||||
*
|
||||
* @param { number } connection - the connection id returned from connectAbility api.
|
||||
* @returns { Promise<void> } The promise returned by the function.
|
||||
|
4
api/application/UIAbilityContext.d.ts
vendored
4
api/application/UIAbilityContext.d.ts
vendored
@ -1622,7 +1622,7 @@ export default class UIAbilityContext extends Context {
|
||||
connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
|
||||
|
||||
/**
|
||||
* The callback interface is connected successfully.
|
||||
* Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
|
||||
*
|
||||
* @param { number } connection - The number code of the ability connected
|
||||
* @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
|
||||
@ -1636,7 +1636,7 @@ export default class UIAbilityContext extends Context {
|
||||
disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* The callback interface is connected successfully.
|
||||
* Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
|
||||
*
|
||||
* @param { number } connection - The number code of the ability connected
|
||||
* @returns { Promise<void> } The promise returned by the function.
|
||||
|
56
api/application/UIExtensionContext.d.ts
vendored
56
api/application/UIExtensionContext.d.ts
vendored
@ -15,6 +15,7 @@
|
||||
|
||||
import type { AbilityResult } from '../ability/abilityResult';
|
||||
import type { AsyncCallback } from '../@ohos.base';
|
||||
import type { ConnectOptions } from '../ability/connectOptions';
|
||||
import ExtensionContext from './ExtensionContext';
|
||||
import type Want from '../@ohos.app.ability.Want';
|
||||
import type StartOptions from '../@ohos.app.ability.StartOptions';
|
||||
@ -225,4 +226,59 @@ export default class UIExtensionContext extends ExtensionContext {
|
||||
* @since 10
|
||||
*/
|
||||
startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>;
|
||||
|
||||
/**
|
||||
* Connects the current ability to an service extension ability using the AbilityInfo.AbilityType.SERVICE template.
|
||||
* If the caller application is in foreground, you can use this method to connect service extension ability;
|
||||
* If the caller application is in the background, you need to apply for permission:ohos.permission.START_ABILITIES_FROM_BACKGROUND.
|
||||
* If the target service extension ability is visible, you can connect the target service extension ability;
|
||||
* If the target service extension ability is invisible,
|
||||
* you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to connect target invisible service extension ability.
|
||||
* If the target service extension ability is in cross-device, you need to apply for permission:ohos.permission.DISTRIBUTED_DATASYNC.
|
||||
*
|
||||
* @param { Want } want - The element name of the service ability
|
||||
* @param { ConnectOptions } options - The remote object instance
|
||||
* @returns { number } Returns the number code of the ability connected
|
||||
* @throws { BusinessError } 201 - The application does not have permission to call the interface.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000001 - The specified ability does not exist.
|
||||
* @throws { BusinessError } 16000002 - Incorrect ability type.
|
||||
* @throws { BusinessError } 16000004 - Can not start invisible component.
|
||||
* @throws { BusinessError } 16000005 - The specified process does not have the permission.
|
||||
* @throws { BusinessError } 16000006 - Cross-user operations are not allowed.
|
||||
* @throws { BusinessError } 16000008 - The crowdtesting application expires.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @throws { BusinessError } 16000053 - The ability is not on the top of the UI.
|
||||
* @throws { BusinessError } 16000055 - Installation-free timed out.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
|
||||
|
||||
/**
|
||||
* Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
|
||||
*
|
||||
* @param { number } connection - The number code of the ability connected
|
||||
* @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Disconnect an ability from a service extension, in contrast to {@link connectAbility}.
|
||||
*
|
||||
* @param { number } connection - The number code of the ability connected
|
||||
* @returns { Promise<void> } The promise returned by the function.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @throws { BusinessError } 16000050 - Internal error.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
disconnectServiceExtensionAbility(connection: number): Promise<void>;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user