![]() The timer can trigger up to 1 second early or late.continueOnError - an optional boolean flag, defaulting to false, which indicates that the timer should not be automatically stopped if the callback function results in an error.fn - a function to call every time the timer triggers.repeatInterval - (optional) number of seconds between triggers, or a string in the format "DDd", "DDdHHh", "HHhMMm", "HHh" or "MMm" indicating days, hours and/or minutes between triggers if omitted or 0 the timer will trigger only once. ![]() time - number of seconds after (local) midnight, or a string in the format "HH:MM" (24-hour local time), indicating the desired trigger time.Hs.timer.doAt(time, fn) -> timerĬreates and starts a timer which will perform fn at the given (local) time and then (optionally) repeat it every interval. The callback can be cancelled by calling the :stop() method on the returned object before sec seconds have passed.There is no need to call :start() on the returned object, the timer will be already running.sec - A number of seconds to wait before calling the function.For all other purposes, you really should be splitting up your code into multiple functions and calling hs.timer.doAfter() ![]() This is only provided as a last resort, or for extremely short sleeps. This means no hotkeys or events will be processed in that time, no GUI updates will happen, and no Lua will execute. Use of this function is strongly discouraged, as it blocks all main-thread execution in Hammerspoon.microsecs - A number containing a time in microseconds to block for.This has much better precision than os.time(), which is limited to whole seconds.īlocks Lua execution for the specified time.Gets the (fractional) number of seconds since the UNIX epoch (January 1, 1970) "DDdHHh", "HHhMMm", "MMmSSs", "DDd", "HHh", "MMm", "SSs", "NNNNms" - represents a duration in days, hours, minutes, seconds and/or milliseconds."HH:MM:SS" or "HH:MM" - represents a time of day (24-hour clock), returns the number of seconds since midnight.timeOrDuration - a string that can have any of the following formats:.Hs.conds(timeOrDuration) -> secondsĬonverts a string with a time of day or a duration into number of seconds ![]() Returns the number of seconds since local time midnight
0 Comments
Leave a Reply. |