mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-08 15:54:33 +00:00
add event hub crossplatform label
Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
parent
c1c1ede5d2
commit
1801811b73
11
api/@ohos.app.ability.common.d.ts
vendored
11
api/@ohos.app.ability.common.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2024 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
|
||||
@ -259,6 +259,15 @@ declare namespace common {
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* The event center of a context, support the subscription and publication of events.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @stagemodelonly
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export type EventHub = _EventHub.default;
|
||||
|
||||
/**
|
||||
|
12
api/application/Context.d.ts
vendored
12
api/application/Context.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 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
|
||||
@ -332,6 +332,16 @@ export default class Context extends BaseContext {
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* Indicates event hub.
|
||||
*
|
||||
* @type { EventHub }
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @stagemodelonly
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
eventHub: EventHub;
|
||||
|
||||
/**
|
||||
|
47
api/application/EventHub.d.ts
vendored
47
api/application/EventHub.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2024 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
|
||||
@ -30,6 +30,15 @@ import { BusinessError } from '../@ohos.base';
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* The event center of a context, support the subscription and publication of events.
|
||||
*
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @stagemodelonly
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
export default class EventHub {
|
||||
/**
|
||||
* Subscribe to an event.
|
||||
@ -52,6 +61,18 @@ export default class EventHub {
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* Subscribe to an event.
|
||||
*
|
||||
* @param { string } event - Indicates the event.
|
||||
* @param { Function } callback - Indicates the callback.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @stagemodelonly
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
on(event: string, callback: Function): void;
|
||||
|
||||
/**
|
||||
@ -75,6 +96,18 @@ export default class EventHub {
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* Unsubscribe from an event.
|
||||
*
|
||||
* @param { string } event - Indicates the event.
|
||||
* @param { Function } [callback] - Indicates the callback.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @stagemodelonly
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
off(event: string, callback?: Function): void;
|
||||
|
||||
/**
|
||||
@ -98,5 +131,17 @@ export default class EventHub {
|
||||
* @atomicservice
|
||||
* @since 11
|
||||
*/
|
||||
/**
|
||||
* Trigger the event callbacks.
|
||||
*
|
||||
* @param { string } event - Indicates the event.
|
||||
* @param { Object[] } args - Indicates the callback arguments.
|
||||
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @stagemodelonly
|
||||
* @crossplatform
|
||||
* @atomicservice
|
||||
* @since 12
|
||||
*/
|
||||
emit(event: string, ...args: Object[]): void;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user