1pub mod app_devtools;
15pub mod bridge;
16pub mod frames;
17mod history;
18pub mod host;
19pub mod runtime;
20pub mod standins;
21pub mod testing;
22mod unsupported;
23
24pub use bridge::{with_app, with_commit, with_published, with_published_app, Phase};
25pub use runtime::{JsError, JsRuntime};
26
27pub use redjs;
28#[cfg(feature = "webgpu")]
29pub use redjs_webgpu;
30
31pub mod built {
32 pub const WEBGPU: bool = cfg!(feature = "webgpu");
33 pub const AUDIO: bool = cfg!(feature = "audio");
34 pub const STORAGES: bool = cfg!(feature = "storages");
35 pub const CLIPBOARD: bool = cfg!(feature = "clipboard");
36 pub const INDEXEDDB: bool = cfg!(feature = "indexeddb");
37}
38
39#[macro_export]
42macro_rules! host_fn {
43 ($vis:vis fn $name:ident($g:ident, $args:ident) $body:block) => {
44 $crate::raw_host_fn! {
45 $vis fn $name(g, cf) {
46 match ::std::panic::catch_unwind(::std::panic::AssertUnwindSafe(|| {
47 let $g = g;
48 let _profile = $crate::redjs::profiling::host_span_at(g as usize, ::core::stringify!($name), ::core::file!(), ::core::line!(), ::core::column!());
49 let $args = unsafe { $crate::redjs::api::HostArgs::new(cf) };
50 let _ = &$args;
51 $body
52 })) {
53 Ok(v) => v,
54 Err(payload) => $crate::bridge::panic_to_js(g, payload),
55 }
56 }
57 }
58 };
59}
60
61#[macro_export]
63macro_rules! raw_host_fn {
64 ($vis:vis fn $name:ident($g:ident, $cf:ident) $body:block) => {
65 #[cfg(all(target_os = "windows", target_arch = "x86_64"))]
66 $vis unsafe extern "sysv64" fn $name($g: *mut ::core::ffi::c_void, $cf: *mut ::core::ffi::c_void) -> u64 $body
67 #[cfg(not(all(target_os = "windows", target_arch = "x86_64")))]
68 $vis unsafe extern "C" fn $name($g: *mut ::core::ffi::c_void, $cf: *mut ::core::ffi::c_void) -> u64 $body
69 };
70}