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": {
"build": "tsup",
"build:samples": "tsup --config tsup.samples.config.ts",
"prepare": "npm run build && npm run build:samples",
"prepare": "npm run build",
"test": "vitest",
"test:run": "vitest run",
"typecheck": "tsc --noEmit"

View File

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