diff --git a/ui/arduino/store.js b/ui/arduino/store.js index 04889b4..f82c992 100644 --- a/ui/arduino/store.js +++ b/ui/arduino/store.js @@ -9,6 +9,9 @@ const newFileContent = `# This program was created in Arduino Lab for MicroPytho print('Hello, MicroPython!') ` +async function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} async function confirmDialog(msg, cancelMsg, confirmMsg) { // cancelMsg = cancelMsg || 'Cancel' @@ -103,15 +106,16 @@ async function store(state, emitter) { emitter.emit('render') }) - emitter.on('change-view', (view) => { - if (state.view === 'file-manager') { - if (view != state.view) { - state.selectedFiles = [] - } - emitter.emit('refresh-files') + emitter.on('change-view', async (view) => { + if (state.view === view) { + return + } else { + state.selectedFiles = [] } if(view === 'file-manager') { emitter.emit('stop') + await sleep(250) // Give the board time to stop the program and return to the prompt + emitter.emit('refresh-files') } state.view = view emitter.emit('render')
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: