concoct 0.18.0

Cross-platform UI framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::use_ref;
use crate::Runtime;

/// Hook to store a function that's triggered on removal of the current `View`.
pub fn use_on_drop(on_drop: impl FnMut() + 'static) {
    use_ref(|| {
        Runtime::current()
            .inner
            .borrow()
            .scope
            .as_ref()
            .unwrap()
            .inner
            .borrow_mut()
            .droppers
            .push(Box::new(on_drop))
    });
}