File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ const newFileContent = `# This program was created in Arduino Lab for MicroPytho
9
9
10
10
print('Hello, MicroPython!')
11
11
`
12
+ async function sleep ( ms ) {
13
+ return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
14
+ }
12
15
13
16
async function confirmDialog ( msg , cancelMsg , confirmMsg ) {
14
17
// cancelMsg = cancelMsg || 'Cancel'
@@ -103,15 +106,16 @@ async function store(state, emitter) {
103
106
emitter . emit ( 'render' )
104
107
} )
105
108
106
- emitter . on ( 'change-view' , ( view ) => {
107
- if ( state . view === 'file-manager' ) {
108
- if ( view != state . view ) {
109
- state . selectedFiles = [ ]
110
- }
111
- emitter . emit ( 'refresh-files' )
109
+ emitter . on ( 'change-view' , async ( view ) => {
110
+ if ( state . view === view ) {
111
+ return
112
+ } else {
113
+ state . selectedFiles = [ ]
112
114
}
113
115
if ( view === 'file-manager' ) {
114
116
emitter . emit ( 'stop' )
117
+ await sleep ( 250 ) // Give the board time to stop the program and return to the prompt
118
+ emitter . emit ( 'refresh-files' )
115
119
}
116
120
state . view = view
117
121
emitter . emit ( 'render' )
You can’t perform that action at this time.
0 commit comments