You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. // @flow
  2. import debounce from 'lodash/debounce';
  3. import { NativeModules } from 'react-native';
  4. import { getAppProp } from '../../base/app';
  5. import { readyToClose } from '../external-api/actions';
  6. /**
  7. * Sends a specific event to the native counterpart of the External API. Native
  8. * apps may listen to such events via the mechanisms provided by the (native)
  9. * mobile Jitsi Meet SDK.
  10. *
  11. * @param {Object} store - The redux store.
  12. * @param {string} name - The name of the event to send.
  13. * @param {Object} data - The details/specifics of the event to send determined
  14. * by/associated with the specified {@code name}.
  15. * @returns {void}
  16. */
  17. export function sendEvent(store: Object, name: string, data: Object) {
  18. // The JavaScript App needs to provide uniquely identifying information to
  19. // the native ExternalAPI module so that the latter may match the former to
  20. // the native view which hosts it.
  21. const externalAPIScope = getAppProp(store, 'externalAPIScope');
  22. externalAPIScope
  23. && NativeModules.ExternalAPI.sendEvent(name, data, externalAPIScope);
  24. }
  25. /**
  26. * Debounced sending of `readyToClose`.
  27. */
  28. export const _sendReadyToClose = debounce(dispatch => {
  29. dispatch(readyToClose());
  30. }, 2500, { leading: true });