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
@@ -139,7 +139,7 @@ export const render_initial_state = (ui, state, example) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const apply_side_effects = (prev, next, command, ui) => {
|
export const apply_side_effects = (prev, next, ui) => {
|
||||||
if(prev.project_dir != next.project_dir) {
|
if(prev.project_dir != next.project_dir) {
|
||||||
ui.files.render(next)
|
ui.files.render(next)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ export const exec = (cmd, ...args) => {
|
|||||||
// Wrap with_code_execution, because rendering values can trigger execution
|
// Wrap with_code_execution, because rendering values can trigger execution
|
||||||
// of code by toString() and toJSON() methods
|
// of code by toString() and toJSON() methods
|
||||||
with_code_execution(() => {
|
with_code_execution(() => {
|
||||||
apply_side_effects(state, nextstate, cmd, ui);
|
apply_side_effects(state, nextstate, 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