Нет описания

RtcEngine.js 784B

1234567891011121314151617181920212223242526272829
  1. import {
  2. NativeModules,
  3. findNodeHandle,
  4. NativeAppEventEmitter
  5. } from 'react-native';
  6. const { Agora } = NativeModules
  7. export default {
  8. ...Agora,
  9. init(options = {}) {
  10. this.listener && this.listener.remove();
  11. Agora.init(options);
  12. },
  13. joinChannel(channelName = '00001', uid = 0){
  14. Agora.joinChannel(channelName, uid)
  15. },
  16. eventEmitter(fnConf) {
  17. //there are no `removeListener` for NativeAppEventEmitter & DeviceEventEmitter
  18. this.listener && this.listener.remove();
  19. this.listener = NativeAppEventEmitter.addListener('agoraEvent', event => {
  20. fnConf[event['type']] && fnConf[event['type']](event);
  21. });
  22. },
  23. removeEmitter() {
  24. this.listener && this.listener.remove();
  25. }
  26. };