lib.rs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #![doc = include_str!("../README.md")]
  2. #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
  3. #![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
  4. /// The base class that the JS channel will extend
  5. pub static INTERPRETER_JS: &str = include_str!("./js/core.js");
  6. /// The code explicitly for desktop/liveview that bridges the eval gap between the two
  7. pub static NATIVE_JS: &str = include_str!("./js/native.js");
  8. #[cfg(all(feature = "binary-protocol", feature = "sledgehammer"))]
  9. mod write_native_mutations;
  10. #[cfg(all(feature = "binary-protocol", feature = "sledgehammer"))]
  11. pub use write_native_mutations::*;
  12. #[cfg(feature = "sledgehammer")]
  13. pub mod unified_bindings;
  14. #[cfg(feature = "sledgehammer")]
  15. pub use unified_bindings::*;
  16. // Common bindings for minimal usage.
  17. #[cfg(all(feature = "minimal_bindings", feature = "webonly"))]
  18. pub mod minimal_bindings {
  19. use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
  20. /// Some useful snippets that we use to share common functionality between the different platforms we support.
  21. ///
  22. /// This maintains some sort of consistency between web, desktop, and liveview
  23. #[wasm_bindgen(module = "/src/js/common.js")]
  24. extern "C" {
  25. /// Set the attribute of the node
  26. pub fn setAttributeInner(node: JsValue, name: &str, value: JsValue, ns: Option<&str>);
  27. /// Roll up all the values from the node into a JS object that we can deserialize
  28. pub fn collectFormValues(node: JsValue) -> JsValue;
  29. }
  30. }