Дамян Минков 6682543691 Moves analytics loading to react. (#1945)
* feat(analytics): move to React

The analytics handlers have been moved to JitsiMeetGlobalNS, so now they are
stored in `window.JitsiMeetJS.app.analyticsHandlers`.

The analytics handlers are re-downloaded and re-initialized on every
lib-jitsi-meet initialization, which happens every time the config is changed
(moving between deployments in the mobile app).

* Adds legacy support for old analytics location.
2017-09-01 14:14:03 -05:00

23 lines
555 B
JavaScript

import { MiddlewareRegistry } from '../base/redux';
import { LIB_DID_INIT } from '../base/lib-jitsi-meet';
import { initAnalytics } from './functions';
/**
* Middleware which intercepts config actions to handle evaluating analytics
* config based on the config stored in the store.
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
case LIB_DID_INIT: {
initAnalytics(store);
break;
}
}
return next(action);
});