snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
43
react/features/web-hid/reducer.ts
Normal file
43
react/features/web-hid/reducer.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
||||
|
||||
import { CLOSE_HID_DEVICE, INIT_DEVICE, UPDATE_DEVICE } from './actionTypes';
|
||||
import { IDeviceInfo } from './types';
|
||||
|
||||
/**
|
||||
* The initial state of the web-hid feature.
|
||||
*/
|
||||
const DEFAULT_STATE = {
|
||||
deviceInfo: {} as IDeviceInfo
|
||||
};
|
||||
|
||||
export interface IWebHid {
|
||||
deviceInfo: IDeviceInfo;
|
||||
}
|
||||
|
||||
|
||||
ReducerRegistry.register<IWebHid>(
|
||||
'features/web-hid',
|
||||
(state: IWebHid = DEFAULT_STATE, action): IWebHid => {
|
||||
switch (action.type) {
|
||||
case INIT_DEVICE:
|
||||
return {
|
||||
...state,
|
||||
deviceInfo: action.deviceInfo
|
||||
};
|
||||
case UPDATE_DEVICE:
|
||||
return {
|
||||
...state,
|
||||
deviceInfo: {
|
||||
...state.deviceInfo,
|
||||
...action.updates
|
||||
}
|
||||
};
|
||||
case CLOSE_HID_DEVICE:
|
||||
return {
|
||||
...state,
|
||||
deviceInfo: DEFAULT_STATE.deviceInfo
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user