This commit is contained in:
Dmitry Vasilev
2023-07-13 20:03:33 +03:00
parent eedfdabfa7
commit 4b4af455bd

View File

@@ -142,23 +142,6 @@ export const reload_app_window = state => {
} }
const read_modules = async () => {
const default_module = {'': localStorage.code || EXAMPLE}
const project_dir = await open_dir(false)
if(project_dir == null) {
return {
project_dir: await examples_promise,
files: default_module,
has_file_system_access: false,
}
} else {
return {
project_dir,
files: default_module,
has_file_system_access: true,
}
}
}
const get_entrypoint_settings = () => { const get_entrypoint_settings = () => {
@@ -196,12 +179,27 @@ let COMMANDS
let ui let ui
let state let state
export const init = (container, _COMMANDS) => { export const init = async (container, _COMMANDS) => {
COMMANDS = _COMMANDS COMMANDS = _COMMANDS
set_error_handler(window) set_error_handler(window)
read_modules().then(initial_state => { const default_module = {'': localStorage.code || EXAMPLE}
let initial_state
const project_dir = await open_dir(false)
if(project_dir == null) {
initial_state = {
project_dir: await examples_promise,
files: default_module,
has_file_system_access: false,
}
} else {
initial_state = {
project_dir,
files: default_module,
has_file_system_access: true,
}
}
state = COMMANDS.get_initial_state( state = COMMANDS.get_initial_state(
{ {
@@ -221,7 +219,6 @@ export const init = (container, _COMMANDS) => {
render_initial_state(ui, state) render_initial_state(ui, state)
open_run_iframe(state) open_run_iframe(state)
})
} }
export const get_state = () => state export const get_state = () => state