@@ -1,10 +1,11 @@
1use bumpalo::{Bump, BumpAllocSafe};
1use bumpalo::{Bump, BumpAllocSafe};
2use wasm_bindgen::prelude::*;
3use wasm_bindgen::prelude::*;
4pub mod js {
5pub mod js {
5 use wasm_bindgen::prelude::*;
6 use wasm_bindgen::prelude::*;
7− #[wasm_bindgen(module = "dodrio/change-list")]
8+ #[wasm_bindgen]
8 extern "C" {
9 extern "C" {
9 #[derive(Clone, Debug)]
10 #[derive(Clone, Debug)]
10 pub type ChangeList;
11 pub type ChangeList;
@@ -12,10 +13,10 @@ pub mod js {
12 #[wasm_bindgen(constructor)]
13 #[wasm_bindgen(constructor)]
13 pub fn new(container: &web_sys::Node) -> ChangeList;
14 pub fn new(container: &web_sys::Node) -> ChangeList;
15− #[wasm_bindgen(method, js_name = addChangeListRange)]
16+ #[wasm_bindgen(structural, method, js_name = addChangeListRange)]
16 pub fn add_change_list_range(this: &ChangeList, start: usize, len: usize);
17 pub fn add_change_list_range(this: &ChangeList, start: usize, len: usize);
18− #[wasm_bindgen(method, js_name = applyChanges)]
19+ #[wasm_bindgen(structural, method, js_name = applyChanges)]
19 pub fn apply_changes(this: &ChangeList, memory: JsValue);
20 pub fn apply_changes(this: &ChangeList, memory: JsValue);
@@ -27,6 +28,17 @@ pub(crate) struct ChangeList {
28impl ChangeList {
29impl ChangeList {
29 pub(crate) fn new(container: &web_sys::Node) -> ChangeList {
30 pub(crate) fn new(container: &web_sys::Node) -> ChangeList {
31+ // XXX: Because wasm-bindgen-test doesn't support third party JS
32+ // dependencies, we can't use `wasm_bindgen(module = "...")` for our
33+ // `ChangeList` JS import. Instead, this *should* be a local JS snippet,
34+ // but that isn't implemented yet:
35+ // https://github.com/rustwasm/rfcs/pull/6
36+ static EVAL: Once = Once::new();
38+ js_sys::eval(include_str!("../js/change-list.js"))
39+ .expect("should eval change-list.js OK");
30 let bump = Bump::new();
42 let bump = Bump::new();
31 let js = js::ChangeList::new(container);
43 let js = js::ChangeList::new(container);
32 ChangeList { bump, js }
44 ChangeList { bump, js }