jiti-meet/react/features/base/app/reducer.js

40 lines
862 B
JavaScript
Raw Normal View History

2017-10-17 22:09:52 +00:00
// @flow
import { ReducerRegistry } from '../redux';
2017-06-09 19:09:23 +00:00
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';
ReducerRegistry.register('features/base/app', (state = {}, action) => {
switch (action.type) {
2017-06-09 19:09:23 +00:00
case APP_WILL_MOUNT: {
const { app } = action;
if (state.app !== app) {
return {
...state,
2016-12-07 22:08:35 +00:00
/**
* The one and only (i.e. singleton) {@link BaseApp} instance
* which is currently mounted.
2016-12-07 22:08:35 +00:00
*
* @type {BaseApp}
2016-12-07 22:08:35 +00:00
*/
2017-06-09 19:09:23 +00:00
app
};
}
break;
2017-06-09 19:09:23 +00:00
}
case APP_WILL_UNMOUNT:
if (state.app === action.app) {
return {
...state,
2016-12-07 22:08:35 +00:00
app: undefined
};
}
break;
}
return state;
});