mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
refactor
This commit is contained in:
2
src/effects.js
vendored
2
src/effects.js
vendored
@@ -131,7 +131,7 @@ export const render_initial_state = (ui, state) => {
|
|||||||
ui.editor.switch_session(state.current_module)
|
ui.editor.switch_session(state.current_module)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const render_common_side_effects = (prev, next, command, ui) => {
|
export const apply_side_effects = (prev, next, command, ui) => {
|
||||||
if(
|
if(
|
||||||
prev.project_dir != next.project_dir
|
prev.project_dir != next.project_dir
|
||||||
||
|
||
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {UI} from './editor/ui.js'
|
import {UI} from './editor/ui.js'
|
||||||
import {EFFECTS, render_initial_state, render_common_side_effects} from './effects.js'
|
import {EFFECTS, render_initial_state, apply_side_effects} from './effects.js'
|
||||||
import {load_dir} from './filesystem.js'
|
import {load_dir} from './filesystem.js'
|
||||||
|
|
||||||
const EXAMPLE = `const fib = n =>
|
const EXAMPLE = `const fib = n =>
|
||||||
@@ -231,7 +231,7 @@ export const exec = (cmd, ...args) => {
|
|||||||
|
|
||||||
|
|
||||||
with_code_execution(() => {
|
with_code_execution(() => {
|
||||||
render_common_side_effects(state, nextstate, cmd, ui);
|
apply_side_effects(state, nextstate, cmd, ui);
|
||||||
|
|
||||||
if(effects != null) {
|
if(effects != null) {
|
||||||
(Array.isArray(effects) ? effects : [effects]).forEach(e => {
|
(Array.isArray(effects) ? effects : [effects]).forEach(e => {
|
||||||
|
|||||||
Reference in New Issue
Block a user