2018-07-15 14:50:54 +00:00
|
|
|
// @flow
|
|
|
|
|
2022-06-16 09:49:07 +00:00
|
|
|
import debounce from 'lodash/debounce';
|
2018-07-15 14:50:54 +00:00
|
|
|
import { NativeModules } from 'react-native';
|
|
|
|
|
2022-06-16 09:49:07 +00:00
|
|
|
import { readyToClose } from '../external-api/actions';
|
|
|
|
|
2018-07-15 14:50:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends a specific event to the native counterpart of the External API. Native
|
|
|
|
* apps may listen to such events via the mechanisms provided by the (native)
|
|
|
|
* mobile Jitsi Meet SDK.
|
|
|
|
*
|
|
|
|
* @param {Object} store - The redux store.
|
|
|
|
* @param {string} name - The name of the event to send.
|
|
|
|
* @param {Object} data - The details/specifics of the event to send determined
|
|
|
|
* by/associated with the specified {@code name}.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export function sendEvent(store: Object, name: string, data: Object) {
|
2022-07-05 09:40:03 +00:00
|
|
|
NativeModules.ExternalAPI.sendEvent(name, data);
|
2018-07-15 14:50:54 +00:00
|
|
|
}
|
2022-06-16 09:49:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Debounced sending of `readyToClose`.
|
|
|
|
*/
|
|
|
|
export const _sendReadyToClose = debounce(dispatch => {
|
|
|
|
dispatch(readyToClose());
|
|
|
|
}, 2500, { leading: true });
|