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

middleware.ts 710B

123456789101112131415161718192021222324
  1. import { UPDATE_DEVICE_LIST } from '../base/devices/actionTypes';
  2. import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
  3. /**
  4. * Implements the middleware of the feature device-selection.
  5. *
  6. * @param {Store} store - Redux store.
  7. * @returns {Function}
  8. */
  9. // eslint-disable-next-line no-unused-vars
  10. MiddlewareRegistry.register(store => next => action => {
  11. const result = next(action);
  12. if (action.type === UPDATE_DEVICE_LIST) {
  13. const state = store.getState();
  14. const { availableDevices } = state['features/base/devices'] || {};
  15. if (typeof APP !== 'undefined') {
  16. APP.API.notifyDeviceListChanged(availableDevices);
  17. }
  18. }
  19. return result;
  20. });