fn dispatch_loaded(running: bool, panic: bool) {
    let document = web_sys::window().unwrap().document().unwrap();
    let mut ev_init = CustomEventInit::new();
    // We provide whether or not the app is actually running to this
    ev_init.detail(&if panic { JsValue::NULL } else { running.into() });
    let ev = CustomEvent::new_with_event_init_dict("__perseus_loaded", &ev_init).unwrap();
    document.dispatch_event(&ev).unwrap();
}
Regardless of whether an error or a proper render was triggered, allow the
browser to send through click events etc. (these are suspended until we've
rendered to improve user experience and apparent responsiveness, but this
has no impact on machine-measured metrics on UX). This also allows neat
interoperability with other code running outside Perseus.

This will provide as part of the event whether or not the app is running. If
this is `false`, the app will terminate immediately afterward. If it is
`null` (thank you dynamic typing!), the app has panicked, and further
behavior is unspecified, because the app might have been built with
unwinding panics, and there could be a user function for catching panics.
packages/perseus/src/client.rs