///|
extern "c" fn moonbit_glib_source_remove(tag : UInt) -> Bool = "moonbit_glib_source_remove"
///|
/// Remove a source from the main loop by its ID (as returned by `timeout_add` or `idle_add`).
/// Returns `true` if the source was found and removed.
pub fn source_remove(tag : UInt) -> Bool {
moonbit_glib_source_remove(tag)
}
///|
extern "c" fn moonbit_glib_timeout_add(
interval : UInt,
function : FuncRef[(() -> Bool) -> Bool],
closure : () -> Bool,
) -> UInt = "moonbit_glib_timeout_add"
///|
/// Schedule a callback to run repeatedly at the given interval (in milliseconds).
/// The callback returns `true` to continue, `false` to stop.
pub fn timeout_add(interval : UInt, callback : () -> Bool) -> UInt {
moonbit_glib_timeout_add(interval, fn(f) { f() }, callback)
}