From de44537fd9c920e6927beaff9094869777a94e4e Mon Sep 17 00:00:00 2001 From: zhang_hao_zheng Date: Wed, 25 Jun 2025 15:06:12 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=90=AF=E7=94=A81.2EventHub=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhang_hao_zheng Change-Id: I03f1aa1e077985138e4a5dd74ed9ff13c8266724 --- api/application/EventHub.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 09738ce0f0..b0f35914ef 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -19,6 +19,7 @@ */ import { BusinessError } from '../@ohos.base'; +1 /** * The event center of a context, support the subscription and publication of events. -- Gitee From 9043b7c5dad81486673fa354de30e8e9b516b16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8A=E5=B3=A5?= Date: Wed, 25 Jun 2025 07:10:26 +0000 Subject: [PATCH 2/7] update api/application/EventHub.d.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张昊峥 --- api/application/EventHub.d.ts | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index b0f35914ef..5e8f6995ef 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -160,6 +160,69 @@ declare class EventHub { * @since 12 */ emit(event: string, ...args: Object[]): void; + + /** + * Subscribe to an event. + * + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + on(event: string, callback: Function): void; + + /** + * Unsubscribe from an event. + * + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + off(event: string, callback: Function): void; + + /** + * Unsubscribe from an event. + * + * @param { string } event - Indicates the event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + off(event: string): void; + + /** + * Trigger the event callbacks. + * + * @param { string } event - Indicates the event. + * @param { Object[] } args - Indicates the callback arguments. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + emit(event:string, ...args: FixedArray<(Object|null|undefined)>[]): void; } export default EventHub; \ No newline at end of file -- Gitee From 8ae5e32f30d1f62aba2a62c99fa0c1945b90495f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8A=E5=B3=A5?= Date: Wed, 25 Jun 2025 07:10:50 +0000 Subject: [PATCH 3/7] update api/application/EventHub.d.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张昊峥 Change-Id: I7811aa2fe43f07dc604ff546aac1a283091e9f89 --- api/application/EventHub.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 5e8f6995ef..7fe2eacd5c 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -19,7 +19,6 @@ */ import { BusinessError } from '../@ohos.base'; -1 /** * The event center of a context, support the subscription and publication of events. @@ -212,7 +211,7 @@ declare class EventHub { * Trigger the event callbacks. * * @param { string } event - Indicates the event. - * @param { Object[] } args - Indicates the callback arguments. + * @param { FixedArray<(Object|null|undefined)>[] } args - Indicates the callback arguments. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Ability.AbilityRuntime.Core -- Gitee From fe5a7f31dae9685e1aaacddfd9cdbef0f4fae14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8A=E5=B3=A5?= Date: Wed, 25 Jun 2025 14:19:58 +0000 Subject: [PATCH 4/7] update api/application/EventHub.d.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张昊峥 --- api/application/EventHub.d.ts | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 7fe2eacd5c..79910b95f2 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -190,28 +190,13 @@ declare class EventHub { * @since 20 * @arkts 1.2 */ - off(event: string, callback: Function): void; - - /** - * Unsubscribe from an event. - * - * @param { string } event - Indicates the event. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - off(event: string): void; + off(event: string, callback?: Function): void; /** * Trigger the event callbacks. * * @param { string } event - Indicates the event. - * @param { FixedArray<(Object|null|undefined)>[] } args - Indicates the callback arguments. + * @param { (Object|null|undefined)[] } args - Indicates the callback arguments. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Ability.AbilityRuntime.Core @@ -221,7 +206,7 @@ declare class EventHub { * @since 20 * @arkts 1.2 */ - emit(event:string, ...args: FixedArray<(Object|null|undefined)>[]): void; + emit(event:string, ...args: (Object|null|undefined)[]): void; } export default EventHub; \ No newline at end of file -- Gitee From 682eef722754f02d0115ffbd7d37706470307dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8A=E5=B3=A5?= Date: Wed, 25 Jun 2025 14:31:39 +0000 Subject: [PATCH 5/7] update api/application/EventHub.d.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张昊峥 --- api/application/EventHub.d.ts | 38 ++++------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 79910b95f2..0d569b3e56 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -80,7 +80,8 @@ declare class EventHub { * @stagemodelonly * @crossplatform * @atomicservice - * @since 12 + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ on(event: string, callback: Function): void; @@ -118,7 +119,8 @@ declare class EventHub { * @stagemodelonly * @crossplatform * @atomicservice - * @since 12 + * @since arkts{ '1.1':'12','1.2':'20'} + * @arkts 1.1&1.2 */ off(event: string, callback?: Function): void; @@ -159,38 +161,6 @@ declare class EventHub { * @since 12 */ emit(event: string, ...args: Object[]): void; - - /** - * Subscribe to an event. - * - * @param { string } event - Indicates the event. - * @param { Function } callback - Indicates the callback. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - on(event: string, callback: Function): void; - - /** - * Unsubscribe from an event. - * - * @param { string } event - Indicates the event. - * @param { Function } callback - Indicates the callback. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - off(event: string, callback?: Function): void; /** * Trigger the event callbacks. -- Gitee From 436f344590e78919e1bb2a8973f704c462089d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8A=E5=B3=A5?= Date: Wed, 25 Jun 2025 14:32:35 +0000 Subject: [PATCH 6/7] update api/application/EventHub.d.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张昊峥 --- api/application/EventHub.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 0d569b3e56..469376d6b3 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -167,8 +167,6 @@ declare class EventHub { * * @param { string } event - Indicates the event. * @param { (Object|null|undefined)[] } args - Indicates the callback arguments. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; - * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @crossplatform @@ -176,7 +174,7 @@ declare class EventHub { * @since 20 * @arkts 1.2 */ - emit(event:string, ...args: (Object|null|undefined)[]): void; + emit(event: string, ...args: (Object|null|undefined)[]): void; } export default EventHub; \ No newline at end of file -- Gitee From cba07c9e610849bb5890c57bf70a22c5cd6d6544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8A=E5=B3=A5?= Date: Thu, 26 Jun 2025 07:39:56 +0000 Subject: [PATCH 7/7] update api/application/EventHub.d.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张昊峥 --- api/application/EventHub.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 469376d6b3..7dc88272b9 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -170,7 +170,6 @@ declare class EventHub { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @crossplatform - * @atomicservice * @since 20 * @arkts 1.2 */ -- Gitee