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.

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. });