optimize load path. present menu on version change for changelog

This commit is contained in:
Stewart Allen 2025-12-27 12:39:28 -05:00
commit b45e2ba9b4
3 changed files with 18 additions and 10 deletions

View file

@ -25,7 +25,7 @@ import { settings as set_ctrl } from '../conf/manager.js';
import { settingsOps } from '../conf/settings.js';
import { slider } from '../slider.js';
import { space } from '../../../moto/space.js';
import { VIEWS, MODES, SEED } from '../../core/consts.js';
import { LAST, MODES, SEED, VIEWS } from '../../core/consts.js';
import STACKS from '../stacks.js';
@ -77,7 +77,11 @@ function checkSeed(then) {
});
return true;
}
} else if (sdb[LAST] !== version) {
sdb[LAST] = version;
api.help.show();
}
then();
return false;
}
@ -535,6 +539,6 @@ export function init_input() {
};
return new Promise(resolve => {
api.space.restore(resolve) || checkSeed(resolve) || resolve();
api.space.restore(() => checkSeed(resolve));
});
};

View file

@ -165,9 +165,7 @@ function restore(ondone, skip_widget_load) {
}
if (skip_widget_load) {
if (ondone) {
ondone();
}
ondone && ondone();
return;
}
@ -177,8 +175,9 @@ function restore(ondone, skip_widget_load) {
});
// load any widget by name that was saved to the workspace
toload.forEach(function(widgetid) {
Widget.loadFromState(widgetid, function(widget) {
// after the last widget is loaded, call ondone()
for (let widgetid of toload) {
Widget.loadFromState(widgetid, (widget) => {
if (widget) {
platform.add(widget, 0, position, true);
let ann = api.widgets.annotate(widgetid);
@ -196,9 +195,12 @@ function restore(ondone, skip_widget_load) {
}
}
}, position);
});
};
return toload.length > 0;
// when there is nothing async to load, call ondone()
if (toload.length === 0 && ondone) {
ondone();
}
}
/**

View file

@ -176,10 +176,12 @@ const PATHS = {
pool: "./minion.js"
};
const LAST = 'kiri-last';
const SEED = 'kiri-seed';
export let consts = {
COLOR,
LAST,
LISTS,
MODES,
PATHS,
@ -189,4 +191,4 @@ export let consts = {
beltfact: Math.cos(Math.PI / 4)
};
export { COLOR, LISTS, MODES, VIEWS, PATHS, PMODES, SEED };
export { COLOR, LAST, LISTS, MODES, VIEWS, PATHS, PMODES, SEED };