|
@@ -18,10 +18,9 @@ pub(crate) fn init() -> UnboundedReceiver<Template<'static>> {
|
|
|
|
|
|
#[cfg(debug_assertions)]
|
|
#[cfg(debug_assertions)]
|
|
pub(crate) fn init() -> UnboundedReceiver<Template<'static>> {
|
|
pub(crate) fn init() -> UnboundedReceiver<Template<'static>> {
|
|
|
|
+ use core::panic;
|
|
use std::convert::TryInto;
|
|
use std::convert::TryInto;
|
|
|
|
|
|
- use web_sys::console;
|
|
|
|
-
|
|
|
|
let window = web_sys::window().unwrap();
|
|
let window = web_sys::window().unwrap();
|
|
|
|
|
|
let protocol = if window.location().protocol().unwrap() == "https:" {
|
|
let protocol = if window.location().protocol().unwrap() == "https:" {
|
|
@@ -44,10 +43,9 @@ pub(crate) fn init() -> UnboundedReceiver<Template<'static>> {
|
|
if let Ok(text) = e.data().dyn_into::<js_sys::JsString>() {
|
|
if let Ok(text) = e.data().dyn_into::<js_sys::JsString>() {
|
|
let text: Result<String, _> = text.try_into();
|
|
let text: Result<String, _> = text.try_into();
|
|
if let Ok(string) = text {
|
|
if let Ok(string) = text {
|
|
- console::log_1(&string.clone().into());
|
|
|
|
match serde_json::from_str(Box::leak(string.into_boxed_str())) {
|
|
match serde_json::from_str(Box::leak(string.into_boxed_str())) {
|
|
Ok(template) => _ = tx.unbounded_send(template),
|
|
Ok(template) => _ = tx.unbounded_send(template),
|
|
- Err(e) => console::log_1(&e.to_string().into()),
|
|
|
|
|
|
+ Err(e) => panic!("Failed to parse template: {}", e),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|