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.js 551B

12345678910111213141516171819
  1. /* @flow */
  2. import { getCurrentConference } from '../base/conference';
  3. import { StateListenerRegistry } from '../base/redux';
  4. import { clearNotifications } from './actions';
  5. /**
  6. * StateListenerRegistry provides a reliable way to detect the leaving of a
  7. * conference, where we need to clean up the notifications.
  8. */
  9. StateListenerRegistry.register(
  10. /* selector */ state => getCurrentConference(state),
  11. /* listener */ (conference, { dispatch }) => {
  12. if (!conference) {
  13. dispatch(clearNotifications());
  14. }
  15. }
  16. );