Unsubscribe from Dynamic Common Events
Note:
Currently in the beta phase.
Scenario Description
After completing business requirements, dynamic subscribers should proactively unsubscribe. Call the unsubscribe() method to cancel event subscriptions.
Interface Description
| Interface Name | Description |
|---|---|
| unsubscribe(subscriber: CommonEventSubscriber): Unit | Unsubscribes from common events. |
Development Steps
-
Import the module.
import kit.BasicServicesKit.* -
Follow the steps in the Dynamic Common Event Subscription section to subscribe to an event.
-
Call the unsubscribe() method in CommonEvent to unsubscribe from an event.
// subscriber is the subscriber object created during event subscription CommonEventManager.unsubscribe(subscriber)