2021-04-21 15:51:01 +02:00
|
|
|
import * as tg from "generic-type-guard";
|
|
|
|
|
|
|
|
export const isGameStateEvent =
|
|
|
|
new tg.IsInterface().withProperties({
|
2021-05-25 17:21:02 +02:00
|
|
|
roomId: tg.isString,
|
|
|
|
mapUrl: tg.isString,
|
|
|
|
nickname: tg.isUnion(tg.isString, tg.isNull),
|
|
|
|
uuid: tg.isUnion(tg.isString, tg.isUndefined),
|
|
|
|
startLayerName: tg.isUnion(tg.isString, tg.isNull),
|
|
|
|
tags : tg.isArray(tg.isString),
|
2021-04-21 15:51:01 +02:00
|
|
|
}).get();
|
|
|
|
/**
|
2021-05-25 11:02:25 +02:00
|
|
|
* A message sent from the game to the iFrame when the gameState is received by the script
|
2021-04-21 15:51:01 +02:00
|
|
|
*/
|
2021-05-25 11:02:25 +02:00
|
|
|
export type GameStateEvent = tg.GuardedType<typeof isGameStateEvent>;
|