mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(events): update doc content
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
/**
|
||||
* @name Events
|
||||
* @description
|
||||
* Events is a pub/sub style event system for sending and responding to application-level
|
||||
* events across your app.
|
||||
* @usage
|
||||
@@ -20,11 +22,10 @@ export class Events {
|
||||
private _channels: Array<any> = [];
|
||||
|
||||
/**
|
||||
* Subscribe to an event topic. Events that get posted to that topic
|
||||
* will trigger the provided handler.
|
||||
* Subscribe to an event topic. Events that get posted to that topic will trigger the provided handler.
|
||||
*
|
||||
* @param topic the topic to subscribe to
|
||||
* @param handler the event handler
|
||||
* @param {String} topic the topic to subscribe to
|
||||
* @param {Function} handler the event handler
|
||||
*/
|
||||
subscribe(topic, ...handlers) {
|
||||
if (!this._channels[topic]) {
|
||||
@@ -36,11 +37,10 @@ export class Events {
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe from the given topic. Your handler will
|
||||
* no longer receive events published to this topic.
|
||||
* Unsubscribe from the given topic. Your handler will no longer receive events published to this topic.
|
||||
*
|
||||
* @param topic the topic to unsubscribe from
|
||||
* @param handler the event handler
|
||||
* @param {String} topic the topic to unsubscribe from
|
||||
* @param {Function} handler the event handler
|
||||
*
|
||||
* @return true if a handler was removed
|
||||
*/
|
||||
@@ -78,8 +78,8 @@ export class Events {
|
||||
/**
|
||||
* Publish an event to the given topic.
|
||||
*
|
||||
* @param topic the topic to publish to
|
||||
* @param eventData the data to send as the event
|
||||
* @param {String} topic the topic to publish to
|
||||
* @param {Any} eventData the data to send as the event
|
||||
*/
|
||||
publish(topic, ...args) {
|
||||
var t = this._channels[topic];
|
||||
|
||||
Reference in New Issue
Block a user