Created
April 12, 2023 01:57
-
-
Save thorseraq/ed8c50f5098532697b72e62be6bf8a31 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use yrs::{DeepObservable, Doc, Map, Transact}; | |
| fn main() { | |
| let doc = Doc::new(); | |
| let mut block = doc.get_or_insert_map("block"); | |
| let sub = block.observe_deep(move |_trx, _e| { | |
| println!("subscribe -> observe_deep"); | |
| }); | |
| // drop(sub); // drop sub will lose observation | |
| let mut trx = doc.transact_mut(); | |
| block.insert(&mut trx, "key", "value"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment