Files
jitsi-meet/react/features/mobile/net-interceptor/middleware.js
Saúl Ibarra Corretgé d669a6c73c [RN] Keep track of ongoing network requests
Works only for XHR requests, which is the only network request mobile performs
(WebRTC traffic aside). The fetch API is implemented on top of XHR, so that's
covered too.

Requests are kept in the redux store until they complete, at which point they
are removed.
2017-08-29 18:54:04 -05:00

26 lines
631 B
JavaScript

import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../app';
import { MiddlewareRegistry } from '../../base/redux';
import { startNetInterception, stopNetInterception } from './functions';
/**
* Middleware which captures app startup and conference actions in order to
* clear the image cache.
*
* @returns {Function}
*/
MiddlewareRegistry.register(store => next => action => {
const result = next(action);
switch (action.type) {
case APP_WILL_MOUNT:
startNetInterception(store);
break;
case APP_WILL_UNMOUNT:
stopNetInterception(store);
break;
}
return result;
});