From bcc9e7a382d0c7183b66a1f9ad42fce060591656 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilev Date: Wed, 26 Oct 2022 13:25:10 +0800 Subject: [PATCH] async calls WIP --- src/cmd.js | 5 +++++ src/index.js | 1 + 2 files changed, 6 insertions(+) diff --git a/src/cmd.js b/src/cmd.js index b643c9e..dc62c61 100644 --- a/src/cmd.js +++ b/src/cmd.js @@ -255,6 +255,10 @@ const external_imports_loaded = ( } } +// TODO refactor, make index controlled property and get it from state instead +// of setting to zero +const rerun_code = state => run_code(state, 0) + const input = (state, code, index) => { const files = {...state.files, [state.current_module]: code} const next = run_code({...state, files}, index, [state.current_module]) @@ -785,6 +789,7 @@ export const get_initial_state = state => { export const COMMANDS = { input, + rerun_code, load_dir, create_file, step_into, diff --git a/src/index.js b/src/index.js index d5fdd56..69cb806 100644 --- a/src/index.js +++ b/src/index.js @@ -26,6 +26,7 @@ export const open_run_window = () => { globalThis.run_window.close() } globalThis.run_window = open('about:blank') + exec('rerun_code') } const read_modules = async () => {