1use ion::{ClassDefinition as _, Context, Iterator, Object};
8
9pub mod abort;
10pub mod base64;
11pub mod clone;
12pub mod console;
13pub mod encoding;
14#[cfg(feature = "fetch")]
15pub mod fetch;
16pub mod file;
17pub mod microtasks;
18pub mod streams;
19pub mod timers;
20pub mod url;
21
22pub fn init_globals(cx: &Context, global: &Object) -> bool {
23 let result = base64::define(cx, global)
24 && clone::define(cx, global)
25 && console::define(cx, global)
26 && encoding::define(cx, global)
27 && file::define(cx, global)
28 && streams::define(cx, global)
29 && url::define(cx, global)
30 && Iterator::init_class(cx, global).0;
31
32 #[cfg(feature = "fetch")]
33 {
34 result && fetch::define(cx, global)
35 }
36 #[cfg(not(feature = "fetch"))]
37 {
38 result
39 }
40}
41
42pub fn init_timers(cx: &Context, global: &Object) -> bool {
43 timers::define(cx, global) && abort::define(cx, global)
44}
45
46pub fn init_microtasks(cx: &Context, global: &Object) -> bool {
47 microtasks::define(cx, global)
48}