diff --git a/src/application.rs b/src/application.rs index 68c79f6..e1ec22e 100644 --- a/src/application.rs +++ b/src/application.rs @@ -40,6 +40,8 @@ mod imp { pub struct AardvarkApplication { automerge: RefCell, root: ObjId, + tx: Sender>, + rx: Receiver>, } impl AardvarkApplication { @@ -47,6 +49,8 @@ mod imp { println!("app: {}", text); let mut doc = self.automerge.borrow_mut(); doc.update_text(&self.root, text).unwrap(); + tx.send(doc.save()) + } } @@ -60,9 +64,12 @@ mod imp { let mut am = AutoCommit::new(); let root = am.put_object(automerge::ROOT, "root", ObjType::Text).unwrap(); let automerge = RefCell::new(am); + let (tx, rx) = network::run().expect("running p2p backend"); AardvarkApplication { automerge, root, + tx, + rx, } } } @@ -97,8 +104,6 @@ mod imp { window.upcast() }); - network::run().expect("running p2p backend"); - // Ask the window manager/compositor to present the window window.present(); }