Compare commits

..

No commits in common. "9ed23295aeda9c100e7ed5cc27befe3b659e661e" and "a0b2003c65b164d9606f0c8338ca0fa5a46dd46c" have entirely different histories.

2 changed files with 13 additions and 18 deletions

View File

@ -18,7 +18,7 @@
"scripts": { "scripts": {
"build": "tsup", "build": "tsup",
"build:samples": "tsup --config tsup.samples.config.ts", "build:samples": "tsup --config tsup.samples.config.ts",
"prepare": "npm run build && npm run build:samples", "prepare": "npm run build",
"test": "vitest", "test": "vitest",
"test:run": "vitest run", "test:run": "vitest run",
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit"

View File

@ -60,9 +60,7 @@ export abstract class BaseGameClient<
assignSelector<S>(selector: (t: T) => S, callback: (s: S) => void) { assignSelector<S>(selector: (t: T) => S, callback: (s: S) => void) {
const selected = computed(() => selector(this._context.value)); const selected = computed(() => selector(this._context.value));
return effect(() => { return selected.subscribe(callback);
callback(selected.value);
});
} }
addInterruption() { addInterruption() {
@ -89,20 +87,17 @@ export abstract class BaseGameClient<
} }
} }
try {
callback({ callback({
hasPrompt: true, hasPrompt: true,
player: ctx.player || "global", player: ctx.player || "global",
def: ctx.def, def: ctx.def,
tryAnswer, tryAnswer,
}); });
return await next(); await next();
} finally {
callback({ callback({
hasPrompt: false, hasPrompt: false,
player: ctx.player || "global", player: ctx.player || "global",
}); });
}
}); });
} }
selectStatus(callback: (status: ClientStatus) => void) { selectStatus(callback: (status: ClientStatus) => void) {