fix jsdoc

Change-Id: I69b16464116411f49c826f19d8d7467da4f9acef
Signed-off-by: Baisong Zhong <zhongbaisong@huawei.com>
This commit is contained in:
Baisong Zhong 2023-07-10 18:56:27 +08:00
parent 58ade63967
commit 655fd23a14
3 changed files with 98 additions and 59 deletions

View File

@ -32,8 +32,8 @@ declare namespace commonEvent {
/**
* Publishes an ordered, sticky, or standard common event.
*
* @param { string } event name of the common event.
* @param { AsyncCallback<void> } callback Specified callback method.
* @param { string } event - name of the common event.
* @param { AsyncCallback<void> } callback - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @since 7
* @deprecated since 9
@ -44,10 +44,10 @@ declare namespace commonEvent {
/**
* Publishes an ordered, sticky, or standard common event.
*
* @param { string } event name of the common event.
* @param { CommonEventPublishData } options Indicate the CommonEventPublishData containing the common event content
* and attributes.
* @param { AsyncCallback<void> } callback Specified callback method.
* @param { string } event - name of the common event.
* @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event content
* and attributes.
* @param { AsyncCallback<void> } callback - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @since 7
* @deprecated since 9
@ -58,9 +58,9 @@ declare namespace commonEvent {
/**
* Publishes an ordered, sticky, or standard common event to a specified user.
*
* @param { string } event Specified the names of the common events.
* @param { number } userId Specified the user to receive the common events.
* @param { AsyncCallback<void> } callback Specified callback method.
* @param { string } event - Specified the names of the common events.
* @param { number } userId - Specified the user to receive the common events.
* @param { AsyncCallback<void> } callback - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @systemapi
* @since 8
@ -72,11 +72,11 @@ declare namespace commonEvent {
/**
* Publishes an ordered, sticky, or standard common event to a specified user.
*
* @param { string } event Specified the names of the common events.
* @param { number } userId Specified the user to receive the common events.
* @param { CommonEventPublishData } options Indicates the CommonEventPublishData containing the common event content
* and attributes.
* @param { AsyncCallback<void> } callback Specified callback method.
* @param { string } event - Specified the names of the common events.
* @param { number } userId - Specified the user to receive the common events.
* @param { CommonEventPublishData } options - Indicates the CommonEventPublishData containing the common event content
* and attributes.
* @param { AsyncCallback<void> } callback - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @systemapi
* @since 8
@ -93,8 +93,8 @@ declare namespace commonEvent {
/**
* creates a CommonEventSubscriber for the SubscriberInfo.
*
* @param { CommonEventSubscribeInfo } subscribeInfo Indicates the information of the subscriber.
* @param { AsyncCallback<CommonEventSubscriber> } callback Specified callback method.
* @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber.
* @param { AsyncCallback<CommonEventSubscriber> } callback - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @since 7
* @deprecated since 9
@ -108,7 +108,7 @@ declare namespace commonEvent {
/**
* create the CommonEventSubscriber for the SubscriberInfo.
*
* @param { CommonEventSubscribeInfo } subscribeInfo Indicates the information of the subscriber.
* @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber.
* @returns { Promise<CommonEventSubscriber> } Returns common event subscriber object
* @syscap SystemCapability.Notification.CommonEvent
* @since 7
@ -120,8 +120,8 @@ declare namespace commonEvent {
/**
* subscribe an ordered, sticky, or standard common event.
*
* @param { CommonEventSubscriber } subscriber Indicate the subscriber of the common event.
* @param { AsyncCallback<CommonEventData> } callback Specified callback method.
* @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event.
* @param { AsyncCallback<CommonEventData> } callback - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @since 7
* @deprecated since 9
@ -132,8 +132,8 @@ declare namespace commonEvent {
/**
* unsubscribe from an ordered, sticky, or standard common event.
*
* @param { CommonEventSubscriber } subscriber Indicate the subscriber of the common event.
* @param { AsyncCallback<void> } [callback] Specified callback method.
* @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event.
* @param { AsyncCallback<void> } [callback] - Specified callback method.
* @syscap SystemCapability.Notification.CommonEvent
* @since 7
* @deprecated since 9

View File

@ -18,19 +18,18 @@ import { Callback } from './@ohos.base';
/**
* Provides methods for sending and processing in-process events.
*
* @since 7
* @namespace emitter
* @syscap SystemCapability.Notification.Emitter
* @import import events_emitter from '@ohos.emitter';
* @permission N/A
* @since 7
*/
declare namespace emitter {
/**
* Subscribe to a certain event in persistent manner and receives the event callback.
*
* @param { InnerEvent } event - indicate event to subscribe to.
* @param { Callback<EventData> } callback - indicate callback used to receive the event.
* @syscap SystemCapability.Notification.Emitter
* @since 7
* @param event indicate event to subscribe to.
* @param callback indicate callback used to receive the event.
* @returns -
*/
function on(event: InnerEvent, callback: Callback<EventData>): void;
@ -38,19 +37,19 @@ declare namespace emitter {
* Subscribe to a certain event in one-shot manner and unsubscribe from it
* after the event callback is received.
*
* @param { InnerEvent } event - indicate event to subscribe to in one shot.
* @param { Callback<EventData> } callback - indicate callback used to receive the event.
* @syscap SystemCapability.Notification.Emitter
* @since 7
* @param event indicate event to subscribe to in one shot.
* @param callback indicate callback used to receive the event.
* @returns -
*/
function once(event: InnerEvent, callback: Callback<EventData>): void;
/**
* Unsubscribe from an event.
*
* @param { number } eventId - indicate ID of the event to unsubscribe from.
* @syscap SystemCapability.Notification.Emitter
* @since 7
* @param eventId indicate ID of the event to unsubscribe from.
* @returns -
*/
function off(eventId: number): void;
@ -67,59 +66,95 @@ declare namespace emitter {
/**
* Emits an event to the event queue.
*
* @param { InnerEvent } event - indicate event to emit.
* @param { EventData } [data] - indicate data carried by the event.
* @syscap SystemCapability.Notification.Emitter
* @since 7
* @param event indicate event to emit.
* @param data indicate data carried by the event.
* @returns -
*/
function emit(event: InnerEvent, data?: EventData): void;
/**
* Describes data passed in the event.
*
* @typedef EventData
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
export interface EventData {
/**
* Data carried by the event.
*
* @type { ?object }
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
data?: { [key: string]: any };
}
/**
* Describes an intra-process event.
*
* @typedef InnerEvent
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
export interface InnerEvent {
/**
* Event ID, which is used to identify an event.
*
* @type { number }
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
eventId: number;
/**
* Emit priority of the event. The default priority is {@link EventPriority.LOW}.
*
* @type { ?EventPriority }
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
priority?: EventPriority;
}
/**
* Indicates the emit priority of the event.
*
* @enum { number }
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
export enum EventPriority {
/**
* Indicates that the event will be emitted immediately.
*
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
IMMEDIATE = 0,
/**
* Indicates that the event will be emitted before low-priority events.
*
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
HIGH,
/**
* Indicates that the event will be emitted before idle-priority events. By default, an event is in LOW priority.
*
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
LOW,
/**
* Indicates that the event will be emitted after all the other events.
*
* @syscap SystemCapability.Notification.Emitter
* @since 7
*/
IDLE,
}

View File

@ -32,8 +32,8 @@ declare namespace wantAgent {
/**
* Obtains the bundle name of a WantAgent.
*
* @param { WantAgent } agent whose bundle name to obtain.
* @param { AsyncCallback<string> } callback A callback method to obtain the package name of the WantAgent instance.
* @param { WantAgent } agent - whose bundle name to obtain.
* @param { AsyncCallback<string> } callback - A callback method to obtain the package name of the WantAgent instance.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
* @deprecated since 9
@ -44,7 +44,7 @@ declare namespace wantAgent {
/**
* Obtains the bundle name of a WantAgent.
*
* @param { WantAgent } agent whose bundle name to obtain.
* @param { WantAgent } agent - whose bundle name to obtain.
* @returns { Promise<string> } Returns the bundle name of the {@link WantAgent} if any.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
@ -56,8 +56,8 @@ declare namespace wantAgent {
/**
* Obtains the UID of a WantAgent.
*
* @param { WantAgent } agent whose UID to obtain.
* @param { AsyncCallback<number> } callback Create a callback method for WantAgent.
* @param { WantAgent } agent - whose UID to obtain.
* @param { AsyncCallback<number> } callback - Create a callback method for WantAgent.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
* @deprecated since 9
@ -68,7 +68,7 @@ declare namespace wantAgent {
/**
* Obtains the UID of a WantAgent.
*
* @param { WantAgent } agent whose UID to obtain.
* @param { WantAgent } agent - whose UID to obtain.
* @returns { Promise<number> } Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
@ -80,8 +80,8 @@ declare namespace wantAgent {
/**
* Obtains the {@link Want} of an {@link WantAgent}.
*
* @param { WantAgent } agent Indicates the {@link WantAgent} whose UID is to be obtained.
* @param { AsyncCallback<Want> } callback Obtain the callback method for Want in WantAgent.
* @param { WantAgent } agent - Indicates the {@link WantAgent} whose UID is to be obtained.
* @param { AsyncCallback<Want> } callback - Obtain the callback method for Want in WantAgent.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 7
@ -93,7 +93,7 @@ declare namespace wantAgent {
/**
* Obtains the {@link Want} of an {@link WantAgent}.
*
* @param { WantAgent } agent Indicates the {@link WantAgent} whose UID is to be obtained.
* @param { WantAgent } agent - Indicates the {@link WantAgent} whose UID is to be obtained.
* @returns { Promise<Want> } Returns the {@link Want} of the {@link WantAgent}.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
@ -106,8 +106,8 @@ declare namespace wantAgent {
/**
* Cancel a WantAgent. Only the application that creates the WantAgent can cancel it.
*
* @param { WantAgent } agent to cancel.
* @param { AsyncCallback<void> } callback Cancel the callback method for Want in WantAgent.
* @param { WantAgent } agent - to cancel.
* @param { AsyncCallback<void> } callback - Cancel the callback method for Want in WantAgent.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
* @deprecated since 9
@ -118,7 +118,7 @@ declare namespace wantAgent {
/**
* Cancel a WantAgent. Only the application that creates the WantAgent can cancel it.
*
* @param { WantAgent } agent to cancel.
* @param { WantAgent } agent - to cancel.
* @returns { Promise<void> } The promise returned by the function.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
@ -130,10 +130,10 @@ declare namespace wantAgent {
/**
* Triggers a WantAgent.
*
* @param { WantAgent } agent to trigger.
* @param { TriggerInfo } triggerInfo parameters.
* @param { Callback<CompleteData> } [callback] Indicates the callback method to be called after
* the {@link WantAgent} is triggered.
* @param { WantAgent } agent - to trigger.
* @param { TriggerInfo } triggerInfo - parameters.
* @param { Callback<CompleteData> } [callback] - Indicates the callback method to be called after
* the {@link WantAgent} is triggered.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
* @deprecated since 9
@ -144,9 +144,10 @@ declare namespace wantAgent {
/**
* Checks whether two WantAgent objects are equal.
*
* @param { WantAgent } agent to compare.
* @param { WantAgent } otherAgent WantAgent Object.
* @param { AsyncCallback<boolean> } callback Callback method for determining whether two WantAgent instances are equal.
* @param { WantAgent } agent - to compare.
* @param { WantAgent } otherAgent - WantAgent Object.
* @param { AsyncCallback<boolean> } callback - Callback method for determining whether two WantAgent instances are
* equal.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
* @deprecated since 9
@ -157,8 +158,8 @@ declare namespace wantAgent {
/**
* Checks whether two WantAgent objects are equal.
*
* @param { WantAgent } agent to compare.
* @param { WantAgent } otherAgent WantAgent Object.
* @param { WantAgent } agent - to compare.
* @param { WantAgent } otherAgent - WantAgent Object.
* @returns { Promise<boolean> } Returns {@code true} If the two objects are the same; returns {@code false} otherwise.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
@ -170,8 +171,8 @@ declare namespace wantAgent {
/**
* Obtains a WantAgent object.
*
* @param { WantAgentInfo } info about the WantAgent object to obtain.
* @param { AsyncCallback<WantAgent> } callback Callback method for obtaining the user ID of WantAgent instance.
* @param { WantAgentInfo } info - about the WantAgent object to obtain.
* @param { AsyncCallback<WantAgent> } callback - Callback method for obtaining the user ID of WantAgent instance.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
* @deprecated since 9
@ -182,7 +183,7 @@ declare namespace wantAgent {
/**
* Obtains a WantAgent object.
*
* @param { WantAgentInfo } info about the WantAgent object to obtain.
* @param { WantAgentInfo } info - about the WantAgent object to obtain.
* @returns { Promise<WantAgent> } Returns the created {@link WantAgent} object.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
@ -436,6 +437,9 @@ declare namespace wantAgent {
/**
* WantAgent object.
*
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 7
*/
export type WantAgent = object;