Rename parseState to type

This commit is contained in:
uwap 2018-03-28 04:08:50 +02:00
parent 9dc14a3657
commit 52e825549d
4 changed files with 14 additions and 14 deletions

View file

@ -87,7 +87,7 @@ class App extends React.Component<AppProps & Classes, AppState> {
}
for (let i in topics) {
const topic = topics[i];
const parseValue = this.topics[topic].parseState;
const parseValue = this.topics[topic].type;
const val = parseValue == null ? message.toString() : parseValue(message);
this.setState({mqttState: merge(this.state.mqttState,
{ [topic]: {

View file

@ -6,7 +6,7 @@ export type Topic = {
command: string,
defaultValue: Actual,
values: Map<Internal, Actual>,
parseState?: (msg: Object) => any
type?: (msg: Buffer) => any
};
export type Topics = Map<string, Topic>;