workadventure/front/src/Api/Events/OpenPopupEvent.ts

23 lines
601 B
TypeScript
Raw Normal View History

import * as tg from "generic-type-guard";
2021-09-06 14:27:54 +02:00
const isButtonDescriptor = new tg.IsInterface()
.withProperties({
label: tg.isString,
2021-09-06 14:27:54 +02:00
className: tg.isOptional(tg.isString),
})
.get();
2021-09-06 14:27:54 +02:00
export const isOpenPopupEvent = new tg.IsInterface()
.withProperties({
popupId: tg.isNumber,
targetObject: tg.isString,
message: tg.isString,
2021-09-06 14:27:54 +02:00
buttons: tg.isArray(isButtonDescriptor),
})
.get();
/**
* A message sent from the iFrame to the game to add a message in the chat.
*/
export type OpenPopupEvent = tg.GuardedType<typeof isOpenPopupEvent>;