Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44cf7d7

Browse files
committed
cleanup client state
1 parent0d50ab6 commit44cf7d7

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

‎src/state/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ class StateMachine {
2020

2121
// format state as a string and send it to the client
2222
this.syncState=(state:any):void=>{
23-
console.log(state)
24-
conststateValue:CR.MessageState=stateToString(state.value)
23+
conststateValue:string=stateToString(state.value)
2524
console.log(`STATE:${stateValue}`)
26-
editorDispatch('coderoad.send_state',stateValue)
25+
editorDispatch('coderoad.send_state',{state:stateValue})
2726
}
2827

2928
// callback on all state changes

‎typings/index.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ interface MessageData {
170170
progress:Progress
171171
}
172172

173-
typeMessageState=string
173+
interfaceMessageState{
174+
state:string
175+
}
174176

175177

176-
exporttypeEditorDispatch=(type:string,payload?:MessageData|MessageState)=>void
178+
// todo: type each string param and payload
179+
exporttypeEditorDispatch=(type:string,payload?:MessageData|MessageState|any)=>void

‎web-app/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface ReceivedEvent {
1313
}
1414

1515
constApp=()=>{
16-
constinitialState={SelectTutorial:'Initial'}
16+
constinitialState='SelectTutorial.Initial'
1717

1818
// set state machine state
1919
const[state,setState]=React.useState(initialState)

‎web-app/src/components/Debugger/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import * as React from 'react'
22
import*asCRfrom'typings'
33

44
interfaceProps{
5-
state:object
5+
state:string
66
position:CR.Position
77
progress:CR.Progress
88
}
99

1010
constDebugger=({ state, position, progress}:Props)=>(
1111
<divstyle={{backgroundColor:'#FFFF99',color:'black',padding:'.5rem'}}>
12-
<h4>state:{JSON.stringify(state)}</h4>
12+
<h4>state:{state}</h4>
1313
<pstyle={{backgroundColor:'khaki',padding:'.5rem'}}>position:{JSON.stringify(position)}</p>
1414
<pstyle={{backgroundColor:'moccasin',padding:'.5rem'}}>progress:{JSON.stringify(progress)}</p>
1515
</div>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp