refactor: entity -> MutableSignal

This commit is contained in:
2026-04-03 14:19:44 +08:00
parent b1b059de8c
commit 86714e7837
8 changed files with 51 additions and 62 deletions
+3 -3
View File
@@ -16,7 +16,7 @@ import {
PlayerType,
getBoardRegion,
} from '@/samples/boop';
import {Entity} from "@/utils/entity";
import {MutableSignal} from "@/utils/entity";
import {createGameContext} from "@/";
import type { PromptEvent } from '@/utils/command';
@@ -25,7 +25,7 @@ function createTestContext() {
return { registry, ctx };
}
function getState(ctx: ReturnType<typeof createTestContext>['ctx']): Entity<BoopState> {
function getState(ctx: ReturnType<typeof createTestContext>['ctx']): MutableSignal<BoopState> {
return ctx.state;
}
@@ -35,7 +35,7 @@ function waitForPrompt(ctx: ReturnType<typeof createTestContext>['ctx']): Promis
});
}
function getParts(state: Entity<BoopState>) {
function getParts(state: MutableSignal<BoopState>) {
return state.value.pieces;
}
+2 -2
View File
@@ -8,7 +8,7 @@ import {
TicTacToeState,
WinnerType, PlayerType
} from '@/samples/tic-tac-toe';
import {Entity} from "@/utils/entity";
import {MutableSignal} from "@/utils/mutable-signal";
import {createGameContext} from "@/";
import type { PromptEvent } from '@/utils/command';
@@ -17,7 +17,7 @@ function createTestContext() {
return { registry, ctx };
}
function getState(ctx: ReturnType<typeof createTestContext>['ctx']): Entity<TicTacToeState> {
function getState(ctx: ReturnType<typeof createTestContext>['ctx']): MutableSignal<TicTacToeState> {
return ctx.state;
}