Beginning of frontend + recipe editing
[recipes.git] / frontend / src / utils.rs
1 use web_sys::console;
2
3 pub fn set_panic_hook() {
4 // When the `console_error_panic_hook` feature is enabled, we can call the
5 // `set_panic_hook` function at least once during initialization, and then
6 // we will get better error messages if our code ever panics.
7 //
8 // For more details see
9 // https://github.com/rustwasm/console_error_panic_hook#readme
10 #[cfg(feature = "console_error_panic_hook")]
11 console_error_panic_hook::set_once();
12 }
13
14 #[macro_export]
15 macro_rules! console_log {
16 // Note that this is using the `log` function imported above during
17 // `bare_bones`
18 ($($t:tt)*) => (console::log_1(&format_args!($($t)*).to_string().into()))
19 }