"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7313/react/features/base/net-info/reducer.ts" (2 Jun 2023, 1153 Bytes) of package /linux/misc/jitsi-meet-7313.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 import { NetInfoCellularGeneration, NetInfoStateType } from '@react-native-community/netinfo';
2
3 import ReducerRegistry from '../redux/ReducerRegistry';
4 import { assign } from '../redux/functions';
5
6 import { SET_NETWORK_INFO, _STORE_NETWORK_INFO_CLEANUP } from './actionTypes';
7 import { STORE_NAME } from './constants';
8
9 const DEFAULT_STATE = {
10 isOnline: true
11 };
12
13 export interface INetInfoState {
14 _cleanup?: Function;
15 cellularGeneration?: NetInfoCellularGeneration;
16 details?: Object;
17 isOnline?: boolean;
18 networkType?: NetInfoStateType;
19 }
20
21 /**
22 * The base/net-info feature's reducer.
23 */
24 ReducerRegistry.register<INetInfoState>(STORE_NAME, (state = DEFAULT_STATE, action): INetInfoState => {
25 switch (action.type) {
26 case SET_NETWORK_INFO:
27 return assign(state, {
28 isOnline: action.isOnline,
29 networkType: action.networkType,
30 cellularGeneration: action.cellularGeneration,
31 details: action.details
32 });
33 case _STORE_NETWORK_INFO_CLEANUP:
34 return assign(state, {
35 _cleanup: action.cleanup
36 });
37 default:
38 return state;
39 }
40 });