1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! JavaScript execution on top of Blitz
//!
//! This crate implements a [`ScriptDocument`]: a wrapper around a [`BaseDocument`](blitz_dom::BaseDocument)
//! which can execute the JavaScript contained in (or referenced by) the document's `<script>` tags
//! using the [Boa](https://boajs.dev) JavaScript engine, and which exposes JavaScript DOM APIs
//! (`document`, elements, events, timers, etc) backed by `blitz-dom` to the scripts it runs.
//!
//! It is capable of running real-world JavaScript frameworks such as [Preact](https://preactjs.com/).
//!
//! ### Example
//!
//! ```rust
//! use blitz_script::ScriptDocument;
//! use blitz_dom::DocumentConfig;
//!
//! let mut doc = ScriptDocument::from_html(
//! r#"
//! <div id="root"></div>
//! <script>
//! const el = document.createElement("h1");
//! el.textContent = "Hello from JS";
//! document.getElementById("root").appendChild(el);
//! </script>
//! "#,
//! DocumentConfig::default(),
//! );
//! doc.execute_scripts();
//! ```
pub use DebugController;
pub use ScriptDocument;
pub use ;