Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Context, defineTypes, MapSchema, Schema, type } from '@colyseus/schema';
import { Client } from '..';
import { Room } from '../Room';
/**
* Create another context to avoid these types from being in the user's global `Context`
*/
const context = new Context();
class Player extends Schema { // tslint:disable-line
public connected: boolean;
public sessionId: string;
}
defineTypes(Player, {
connected: 'boolean',
sessionId: 'string',
}, context);
class State extends Schema { // tslint:disable-line
public players = new MapSchema();
}
defineTypes(State, {
players: { map: Player },
}, context);