How to install event listeners in the Cordoba plugin

I would like to ask how you can configure your own event listener in your Cordoba plugin.

I have this one Share dialogfor my Android and I wanted my Javascript to set the listener for onShareDialogDismissoronShareDialogLaunched

What could happen in Javascript would look like this.

// Set a listener for dialog dismiss
document.addEventListener('onShareDialogDismiss', listenerCallback, false);

// Set a listener for dialog launch
document.addEventListener('onShareDialogLaunch', launchCallback, false);

I have this code from Titanium, but it uses the class TiViewProxymost likely to find out how you could make an alternative for fireEvent()in a clean Android implementation

Thanks!

+4
source share
1 answer

-, Cordova?

, cordova-plugin-network-information:

, , JS-, , :

cordova.fireDocumentEvent("offline");

cordova.fireDocumentEvent("online");

cordova.js API:

/**
 * Method to fire event from native code
 * bNoDetach is required for events which cause an exception which needs to be caught in native code
 */
fireDocumentEvent: function(type, data, bNoDetach)

API fireWindowEvent: function(type, data), API-, cordova.js.

+4

Source: https://habr.com/ru/post/1625627/


All Articles