Compare commits
No commits in common. "9ed23295aeda9c100e7ed5cc27befe3b659e661e" and "a0b2003c65b164d9606f0c8338ca0fa5a46dd46c" have entirely different histories.
9ed23295ae
...
a0b2003c65
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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,
|
});
|
||||||
});
|
await next();
|
||||||
return await next();
|
callback({
|
||||||
} finally {
|
hasPrompt: false,
|
||||||
callback({
|
player: ctx.player || "global",
|
||||||
hasPrompt: false,
|
});
|
||||||
player: ctx.player || "global",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
selectStatus(callback: (status: ClientStatus) => void) {
|
selectStatus(callback: (status: ClientStatus) => void) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue