summaryrefslogtreecommitdiff
path: root/node/src/time.ts
blob: e72a27642c3442b992ca640d14c8d0bbb8107f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Astal } from "./imports.js"


export function interval(interval: number, callback: () => void) {
    const t = Astal.Time.interval(interval, null)
    t.connect("now", callback)
    return t
}

export function timeout(timeout: number, callback: () => void) {
    const t = Astal.Time.timeout(timeout, null)
    t.connect("now", callback)
    return t
}

export function idle(callback: () => void) {
    const t = Astal.Time.idle(null)
    t.connect("now", callback)
    return t
}