提交 94e9323d 编写于 作者: E ester.zhou

update doc

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 017fa918
...@@ -31,7 +31,7 @@ Enumerates the event emit priority levels. ...@@ -31,7 +31,7 @@ Enumerates the event emit priority levels.
## emitter.on ## emitter.on
on(event: [InnerEvent](#InnerEvent), callback: Callback\<[EventData](#EventData)\>): void on(event: [InnerEvent](#innerevent), callback: Callback\<[EventData](#eventdata)\>): void
Subscribes to an event in persistent manner. This method uses a callback to return the event. Subscribes to an event in persistent manner. This method uses a callback to return the event.
...@@ -39,14 +39,14 @@ Subscribes to an event in persistent manner. This method uses a callback to retu ...@@ -39,14 +39,14 @@ Subscribes to an event in persistent manner. This method uses a callback to retu
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | ----------------------------------- | ---- | ------------------------ | | -------- | ----------------------------------- | ---- | ------------------------ |
| event | [InnerEvent](#InnerEvent) | Yes| Event to subscribe to in persistent manner.| | event | [InnerEvent](#innerevent) | Yes| Event to subscribe to in persistent manner.|
| callback | Callback\<[EventData](#EventData)\> | Yes| Callback used to return the event.| | callback | Callback\<[EventData](#eventdata)\> | Yes| Callback used to return the event.|
**Example** **Example**
```javascript ```javascript
var innerEvent = { var innerEvent = {
eventId : 1 eventId: 1
}; };
var callback = (eventData) => { var callback = (eventData) => {
console.info('callback'); console.info('callback');
...@@ -56,7 +56,7 @@ emitter.on(innerEvent, callback); ...@@ -56,7 +56,7 @@ emitter.on(innerEvent, callback);
## emitter.once ## emitter.once
once(event: [InnerEvent](#InnerEvent), callback: Callback\<[EventData](#EventData)\>): void once(event: [InnerEvent](#innerevent), callback: Callback\<[EventData](#eventdata)\>): **void**
Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is received. Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is received.
...@@ -64,14 +64,14 @@ Subscribes to an event in one-shot manner and unsubscribes from it after the eve ...@@ -64,14 +64,14 @@ Subscribes to an event in one-shot manner and unsubscribes from it after the eve
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | ----------------------------------- | ---- | ------------------------ | | -------- | ----------------------------------- | ---- | ------------------------ |
| event | [InnerEvent](#InnerEvent) | Yes| Event to subscribe to in one-shot manner.| | event | [InnerEvent](#innerevent) | Yes| Event to subscribe to in one-shot manner.|
| callback | Callback\<[EventData](#EventData)\> | Yes| Callback used to return the event.| | callback | Callback\<[EventData](#eventdata)\> | Yes| Callback used to return the event.|
**Example** **Example**
```javascript ```javascript
var innerEvent = { var innerEvent = {
eventId : 1 eventId: 1
}; };
var callback = (eventData) => { var callback = (eventData) => {
console.info('once callback'); console.info('once callback');
...@@ -107,20 +107,19 @@ Emits an event to the event queue. ...@@ -107,20 +107,19 @@ Emits an event to the event queue.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ------ | ------------------------- | ---- | -------------- | | ------ | ------------------------- | ---- | -------------- |
| event | [InnerEvent](#InnerEvent) | Yes| Event to emit.| | event | [InnerEvent](#innerevent) | Yes| Event to emit.|
| data | [EventData](#EventData) | No| Data carried by the event.| | data | [EventData](#eventdata) | No| Data carried by the event.|
**Example** **Example**
```javascript ```javascript
var eventData = { var eventData = {
data: { data: {
1:"t", 'content': "c",
'content':"c", "id": 1,
"id":1,
}}; }};
var innerEvent = { var innerEvent = {
eventId : 1, eventId: 1,
priority: emitter.EventPriority.HIGH priority: emitter.EventPriority.HIGH
}; };
emitter.emit(innerEvent, eventData); emitter.emit(innerEvent, eventData);
...@@ -133,7 +132,7 @@ Describes an intra-process event. ...@@ -133,7 +132,7 @@ Describes an intra-process event.
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | ------------------------------- | ---- | ---- | ---------------------------------- | | -------- | ------------------------------- | ---- | ---- | ---------------------------------- |
| eventId | number | Yes| Yes| Event ID, which is used to identify an event.| | eventId | number | Yes| Yes| Event ID, which is used to identify an event.|
| priority | [EventPriority](#EventPriority) | Yes| Yes| Emit priority of the event.| | priority | [EventPriority](#eventpriority) | Yes| Yes| Emit priority of the event.|
## EventData ## EventData
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册