export function createEvent ( name , data ) { let event ; if ( typeof data === "string" ) { event = new CustomEvent ( name , { detail : data , } ) ; } else { event = new CustomEvent ( name , { detail : JSON . stringify ( data ) , } ) ; } window . document . dispatchEvent ( event ) ; }