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

26 lines
750 B
TypeScript
Raw Normal View History

import * as tg from "generic-type-guard";
2021-09-06 14:27:54 +02:00
const isSoundConfig = new tg.IsInterface()
.withProperties({
volume: tg.isOptional(tg.isNumber),
loop: tg.isOptional(tg.isBoolean),
mute: tg.isOptional(tg.isBoolean),
rate: tg.isOptional(tg.isNumber),
detune: tg.isOptional(tg.isNumber),
seek: tg.isOptional(tg.isNumber),
2021-09-06 14:27:54 +02:00
delay: tg.isOptional(tg.isNumber),
})
.get();
2021-09-06 14:27:54 +02:00
export const isPlaySoundEvent = new tg.IsInterface()
.withProperties({
url: tg.isString,
2021-09-06 14:27:54 +02:00
config: tg.isOptional(isSoundConfig),
})
.get();
/**
* A message sent from the iFrame to the game to add a message in the chat.
*/
export type PlaySoundEvent = tg.GuardedType<typeof isPlaySoundEvent>;