您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.js 769B

12345678910111213141516171819202122232425262728
  1. // @flow
  2. import { MiddlewareRegistry } from '../../base/redux';
  3. import { getSymbolDescription } from '../../base/util';
  4. import { sendEvent } from '../external-api';
  5. import { INCOMING_CALL_ANSWERED, INCOMING_CALL_DECLINED } from './actionTypes';
  6. /**
  7. * Middleware that captures redux actions and uses the ExternalAPI module to
  8. * turn them into native events so the app knows about them.
  9. *
  10. * @param {Store} store - The redux store.
  11. * @returns {Function}
  12. */
  13. MiddlewareRegistry.register(store => next => action => {
  14. const result = next(action);
  15. switch (action.type) {
  16. case INCOMING_CALL_ANSWERED:
  17. case INCOMING_CALL_DECLINED:
  18. sendEvent(store, getSymbolDescription(action.type), /* data */ {});
  19. break;
  20. }
  21. return result;
  22. });