diff --git a/src/karax.nim b/src/karax.nim index 13c52a2..5ebb7dc 100644 --- a/src/karax.nim +++ b/src/karax.nim @@ -539,3 +539,9 @@ proc loadScript*(jsfilename: cstring; kxi: KaraxInstance = kxi) = s.setAttr "src", jsfilename body.prepend(s) redraw(kxi) + +proc runLater*(action: proc(); later = 400): Timeout {.discardable.} = + proc wrapper() = + action() + redraw() + result = setTimeout(wrapper, later)