I have an event listener in the constructor of one of my pages:
LocalNotifications.on("trigger", (notification, state) => this.locallyNotified);
}
locallyNotified(notification, state) {
// ...
}
In the source for katzer/cordova-plugin-local-notifications (https://github.com/katzer/cordova-plugin-local-notifications/blob/327f01f9e407b13c236b96e3353c86552185ee89/www/local-notification.js) I found this:
/***********
EVENTS
***********/
/**
* Register callback for given event.
*
* @param {String} event
* The event's name
* @param {Function} callback
* The function to be exec as callback
* @param {Object?} scope
* The callback function's scope
*/
exports.on = function (event, callback, scope) {
this.core.on(event, callback, scope);
};
/**
* Unregister callback for given event.
*
* @param {String} event
* The event's name
* @param {Function} callback
* The function to be exec as callback
*/
exports.un = function (event, callback) {
this.core.un(event, callback);
};
But exports.un doesn’t exist in the Ionic Native wrapper. What gives? How do I get rid of the event listener when I no longer need it?