diff options
Diffstat (limited to 'node/src/time.ts')
-rw-r--r-- | node/src/time.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/node/src/time.ts b/node/src/time.ts new file mode 100644 index 0000000..e72a276 --- /dev/null +++ b/node/src/time.ts @@ -0,0 +1,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 +} |