import { WindowLike } from '../protocol/comms' ; import { Message , MessageType } from '../protocol/messages' ; /**
 * Creates a fake message event. This doesn't actually have all the properties
 * that a real message event has, but it defines all the properties we actually
 * use.
 */ export function createMessageEvent < T extends MessageType > ( data , origin ? , ports ? , source ? ) { let fakeMessage = { type : 'message' , data , origin , source , ports } ; return ( fakeMessage as MessageEvent ) ; } /**
 * Creates a fake message event, where the data can be anything. Useful for
 * testing message validators, otherwise use createMessageEvent.
 */ export function createUntypedMessageEvent ( data , origin ? , source ? , ports ? ) { let fakeMessage = { type : 'message' , data , origin , source , ports } ; return ( fakeMessage as MessageEvent ) ; }