Native keep-awake guards for MoonBit on Windows, Linux, and macOS.
///|
test {
assert_eq(
@proton_keepawake.Scope::PreventSystemSleep.to_string(),
"PreventSystemSleep",
)
}@proton_keepawake.with_keepawake(
() => export_files(),
reason="Exporting files",
)@async.with_task_group(tasks => {
let keep_guard = @proton_keepawake.acquire(tasks, reason="Exporting files")
defer keep_guard.release()
export_files()
})pub(all) suberror KeepAwakeError {
BackendUnavailable(detail~ : String)
OperationFailed(operation~ : String, detail~ : String)
} derive(Eq)impl Show for KeepAwakeErrorpub struct Guard {
// private fields
}test {
assert_eq(
@proton_keepawake.Scope::PreventSystemAndDisplaySleep.to_string(),
"PreventSystemAndDisplaySleep",
)
}async fn[G] acquire(group : TaskGroup[G], reason? : String, scope? : Scope) -> Guard raise KeepAwakeErrorlet default_reason : StringInstall
Download zipNative keep-awake guards for MoonBit on Windows, Linux, and macOS.