Files
pybricks-code/src/reducers/status.ts
T
David Lechner 07d0b5ef39 split firmware flashing from lwp3-bootloader
BLE won't always be the only way to flash firmware
2020-06-09 23:51:32 -05:00

23 lines
614 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
import { Reducer } from 'react';
import { combineReducers } from 'redux';
import { Action } from '../actions';
import { FlashFirmwareActionType } from '../actions/flash-firmware';
const progress: Reducer<number, Action> = (state = -1, action) => {
switch (action.type) {
case FlashFirmwareActionType.Progress:
return action.complete / action.total;
default:
return state;
}
};
export interface StatusState {
readonly progress: number;
}
export default combineReducers({ progress });