refacor all the things \o/
This commit is contained in:
parent
d729d949bd
commit
538162d38c
15 changed files with 721 additions and 402 deletions
|
|
@ -3,7 +3,7 @@ declare type Map<K,V> = { [K]: V };
|
|||
declare type Topic = {
|
||||
state: string,
|
||||
command: string,
|
||||
value: any,
|
||||
defaultValue: any,
|
||||
values: Map<string,any>,
|
||||
parseState?: (msg: Object) => any
|
||||
};
|
||||
|
|
@ -14,12 +14,12 @@ declare type ControlUI = {
|
|||
text: string,
|
||||
topic: string,
|
||||
|
||||
enableCondition?: (val: any) => boolean,
|
||||
enableCondition?: (internal: string, actual: any) => boolean,
|
||||
|
||||
// TOGGLE optional properties
|
||||
on?: string, // on override for toggle
|
||||
off?: string, // off override for toggle
|
||||
toggled?: (val: any) => boolean,
|
||||
toggled?: (internal: string, actual: any) => boolean,
|
||||
|
||||
// DROPDOWN optional properties
|
||||
options?: Map<string,any>, //options for dropDown
|
||||
|
|
@ -46,6 +46,17 @@ declare type Config = {
|
|||
|
||||
declare type State = {
|
||||
mqtt: ?any,
|
||||
ui: ?string,
|
||||
values: Map<string,any>
|
||||
uiOpened: ?string,
|
||||
// A map of the actual state values for each topic.
|
||||
// internal is the internal term for the value,
|
||||
// that is equal to the key in the values section of that
|
||||
// topic, for example given by:
|
||||
// values: { off: "OFF", on: "ON" }
|
||||
// and actual is the value of that or whatever is given by mqtt.
|
||||
values: Map<string, { internal: ?string, actual: any }>
|
||||
};
|
||||
|
||||
declare type StateAction = {
|
||||
type: "DISCONNECT" | "CONNECT" | "MESSAGE" | "UI_POPUP",
|
||||
payload?: any
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue