Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas2515 committed Dec 8, 2024
1 parent c9e171e commit 5915ea3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ mod imp {
pub struct AardvarkApplication {
automerge: RefCell<AutoCommit>,
root: ObjId,
tx: Sender<Vec<u8>>,
rx: Receiver<Vec<u8>>,
}

impl AardvarkApplication {
fn update_text(&self, text: &str) {
println!("app: {}", text);
let mut doc = self.automerge.borrow_mut();
doc.update_text(&self.root, text).unwrap();
tx.send(doc.save())

}
}

Expand All @@ -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,
}
}
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 5915ea3

Please sign in to comment.