Compare commits
3 Commits
a0b2003c65
...
9ed23295ae
| Author | SHA1 | Date |
|---|---|---|
|
|
9ed23295ae | |
|
|
ca86bfc427 | |
|
|
09c3fc443b |
|
|
@ -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",
|
"prepare": "npm run build && npm run build:samples",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
"test:run": "vitest run",
|
"test:run": "vitest run",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,9 @@ 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 selected.subscribe(callback);
|
return effect(() => {
|
||||||
|
callback(selected.value);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addInterruption() {
|
addInterruption() {
|
||||||
|
|
@ -87,17 +89,20 @@ export abstract class BaseGameClient<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback({
|
try {
|
||||||
hasPrompt: true,
|
callback({
|
||||||
player: ctx.player || "global",
|
hasPrompt: true,
|
||||||
def: ctx.def,
|
player: ctx.player || "global",
|
||||||
tryAnswer,
|
def: ctx.def,
|
||||||
});
|
tryAnswer,
|
||||||
await next();
|
});
|
||||||
callback({
|
return await next();
|
||||||
hasPrompt: false,
|
} finally {
|
||||||
player: ctx.player || "global",
|
callback({
|
||||||
});
|
hasPrompt: false,
|
||||||
|
player: ctx.player || "global",
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
selectStatus(callback: (status: ClientStatus) => void) {
|
selectStatus(callback: (status: ClientStatus) => void) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue