refactor cmdqueue out of blockcontroller (#65)

This commit is contained in:
Mike Sawka
2024-06-20 16:01:55 -07:00
committed by GitHub
parent 68ca79fcbc
commit 5e655c7c55
7 changed files with 328 additions and 220 deletions
+15
View File
@@ -52,6 +52,11 @@ func CommandTypeUnionMeta() tsgenmeta.TypeUnionMeta {
}
}
type CmdContextType struct {
BlockId string
TabId string
}
type baseCommand struct {
Command string `json:"command"`
}
@@ -60,6 +65,10 @@ type BlockCommand interface {
GetCommand() string
}
type BlockControllerCommand interface {
GetBlockId() string
}
type BlockCommandWrapper struct {
BlockCommand
}
@@ -86,6 +95,7 @@ func ParseCmdMap(cmdMap map[string]any) (BlockCommand, error) {
}
type BlockInputCommand struct {
BlockId string `json:"blockid"`
Command string `json:"command" tstype:"\"controller:input\""`
InputData64 string `json:"inputdata64,omitempty"`
SigName string `json:"signame,omitempty"`
@@ -96,6 +106,10 @@ func (ic *BlockInputCommand) GetCommand() string {
return BlockCommand_Input
}
func (ic *BlockInputCommand) GetBlockId() string {
return ic.BlockId
}
type ResolveIdsCommand struct {
Command string `json:"command" tstype:"\"resolveids\""`
Ids []string `json:"ids"`
@@ -164,6 +178,7 @@ func (bwc *BlockAppendIJsonCommand) GetCommand() string {
type CreateBlockCommand struct {
Command string `json:"command" tstype:"\"createblock\""`
TabId string `json:"tabid"`
BlockDef *wstore.BlockDef `json:"blockdef"`
RtOpts *wstore.RuntimeOpts `json:"rtopts,omitempty"`
}