|
|
|
@ -92,14 +92,14 @@ export function isServerSocketStartupAction(action: AppAction): action is Server |
|
|
|
|
return action.type === SERVER_SOCKET_STARTUP |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const SERVER_SENT = "SERVER_SENT" |
|
|
|
|
export const SERVER_ACT = "SERVER_ACT" |
|
|
|
|
/** Sent by the server when another client has performed an action. Never sent for the client's own actions. */ |
|
|
|
|
export interface ServerSentAction extends BaseAction { |
|
|
|
|
readonly type: typeof SERVER_SENT |
|
|
|
|
export interface ServerActAction extends BaseAction { |
|
|
|
|
readonly type: typeof SERVER_ACT |
|
|
|
|
readonly actions: readonly SyncableAction[] |
|
|
|
|
} |
|
|
|
|
export function isServerSentAction(action: AppAction): action is ServerSentAction { |
|
|
|
|
return action.type === SERVER_SENT |
|
|
|
|
export function isServerActAction(action: AppAction): action is ServerActAction { |
|
|
|
|
return action.type === SERVER_ACT |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export type SyncableAction = SendableAction |
|
|
|
@ -110,11 +110,11 @@ export function isSyncableAction(action: AppAction): action is SyncableAction { |
|
|
|
|
export type ServerAction = |
|
|
|
|
ServerHelloAction | ServerGoodbyeAction | ServerRefreshAction | |
|
|
|
|
ServerOKAction | ServerFailedAction | |
|
|
|
|
ServerSocketStartupAction | ServerSentAction |
|
|
|
|
ServerSocketStartupAction | ServerActAction |
|
|
|
|
export function isServerAction(action: AppAction) { |
|
|
|
|
return isServerHelloAction(action) || isServerGoodbyeAction(action) || isServerRefreshAction(action) |
|
|
|
|
|| isServerOKAction(action) || isServerFailedAction(action) |
|
|
|
|
|| isServerSocketStartupAction(action) || isServerSentAction(action) |
|
|
|
|
|| isServerSocketStartupAction(action) || isServerActAction(action) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const CLIENT_HELLO = "CLIENT_HELLO" |
|
|
|
@ -152,14 +152,14 @@ export interface SentAction { |
|
|
|
|
readonly action: SendableAction |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const CLIENT_SENT = "CLIENT_SENT" |
|
|
|
|
export const CLIENT_ACT = "CLIENT_ACT" |
|
|
|
|
/** Sent to the server when the user performs an action. */ |
|
|
|
|
export interface ClientSentAction extends BaseAction { |
|
|
|
|
readonly type: typeof CLIENT_SENT |
|
|
|
|
readonly nested: readonly SentAction[] |
|
|
|
|
export interface ClientActAction extends BaseAction { |
|
|
|
|
readonly type: typeof CLIENT_ACT |
|
|
|
|
readonly actions: readonly SentAction[] |
|
|
|
|
} |
|
|
|
|
export function isClientSentAction(action: AppAction): action is ClientSentAction { |
|
|
|
|
return action.type === CLIENT_SENT |
|
|
|
|
export function isClientActAction(action: AppAction): action is ClientActAction { |
|
|
|
|
return action.type === CLIENT_ACT |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export type SendableAction = CellColorAction | UserActiveColorAction |
|
|
|
@ -167,9 +167,9 @@ export function isSendableAction(action: AppAction): action is SendableAction { |
|
|
|
|
return isCellColorAction(action) || isUserActiveColorAction(action) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export type ClientAction = ClientHelloAction | ClientRefreshAction | ClientPendingAction | ClientSentAction |
|
|
|
|
export type ClientAction = ClientHelloAction | ClientRefreshAction | ClientPendingAction | ClientActAction |
|
|
|
|
export function isClientAction(action: AppAction): action is ClientAction { |
|
|
|
|
return isClientHelloAction(action) || isClientRefreshAction(action) || isClientPendingAction(action) || isClientSentAction(action) |
|
|
|
|
return isClientHelloAction(action) || isClientRefreshAction(action) || isClientPendingAction(action) || isClientActAction(action) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export type NetworkAction = ServerAction | ClientAction; |
|
|
|
|