debounce_fltk
A simple debounce and throttling tool suitable for FLTK applications.
Can be used to control the frequency of UI event processing or the frequency of function calls for other non UI events.
It also supports executing a task at once or repeatedly after the preset timer expires.
Non macro processing, pure code control. Relying on tokio implementation.
Usage examples:
let mut debounce_update = TokioDebounce::new_debounce({
let vp = version_package.clone();
let mut script_editor = script_editor.clone();
let tree = tree.clone();
let editor_window = editor_window.clone();
move |_| {
update_level_record(tree.clone(), vp.clone(), script_editor.clone(), editor_window.clone());
update_tree_stat(tree.clone(), &mut script_editor);
}
}, Duration::from_millis(100), true);
tree.set_callback({
let mut script_editor = script_editor.clone();
move |tree| {
if let Some(sel) = tree.first_selected_item() {
let depth = sel.depth();
if depth == 2 {
if let Err(_e) = script_editor.config_tabs.set_value(&script_editor.config_trigger_flex) {
}
} else if depth == 3 {
if let Err(_e) = script_editor.config_tabs.set_value(&script_editor.config_expr_flex) {
}
}
}
debounce_update.update_param(());
}
});