Initial Commit
This commit is contained in:
48
shared/types.ts
Normal file
48
shared/types.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
export interface User {
|
||||
id: string;
|
||||
username: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export interface Pixel {
|
||||
x: number;
|
||||
y: number;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export interface Cursor {
|
||||
userId: string;
|
||||
username: string;
|
||||
x: number;
|
||||
y: number;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export interface CanvasUpdate {
|
||||
pixels: Pixel[];
|
||||
}
|
||||
|
||||
export interface LoginRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AuthResponse {
|
||||
token: string;
|
||||
user: User;
|
||||
}
|
||||
|
||||
export interface SocketEvents {
|
||||
'join-canvas': (token: string) => void;
|
||||
'cursor-move': (cursor: Cursor) => void;
|
||||
'paint-pixels': (pixels: Pixel[]) => void;
|
||||
'canvas-update': (update: CanvasUpdate) => void;
|
||||
'cursor-update': (cursors: Cursor[]) => void;
|
||||
'canvas-state': (pixels: Pixel[]) => void;
|
||||
'error': (message: string) => void;
|
||||
}
|
||||
Reference in New Issue
Block a user