Show raw api
{
"functions": [
{
"name": "new",
"desc": "Creates a new timer.",
"params": [
{
"name": "interval",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "Timer"
}
],
"function_type": "static",
"source": {
"line": 35,
"path": "src/Timer/init.luau"
}
},
{
"name": "is",
"desc": "Returns `true` if the given object is a Timer.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "any"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "static",
"source": {
"line": 53,
"path": "src/Timer/init.luau"
}
},
{
"name": "start",
"desc": "Starts the timer. Will do nothing if the timer is already running.\n\n```lua\ntimer:Start()\n```",
"params": [],
"returns": [],
"function_type": "method",
"source": {
"line": 65,
"path": "src/Timer/init.luau"
}
},
{
"name": "tickDelta",
"desc": "Returns the timer tick delta.\n\n```lua\nprint(timer:tickDelta())\n```",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "number\n"
}
],
"function_type": "method",
"source": {
"line": 80,
"path": "src/Timer/init.luau"
}
},
{
"name": "ticked",
"desc": "Returns a boolean indicating whether or not the timer ticked.\n\nHere's an alternative variant to just listening to [Timer.onTicked]:\n\n```lua\nlocal timer = Timer.new(1)\n\nwhile true do\n\tif timer:ticked() then\n\t\twarn(\"we do something every 1~ second\")\n\tend\n\n\ttimer.onTicked:Wait()\nend\n```",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "method",
"source": {
"line": 102,
"path": "src/Timer/init.luau"
}
},
{
"name": "startNow",
"desc": "Starts the timer and fires off the [Timer.onTicked] signal immediately. Will do\nnothing if the timer is already running.\n\n```lua\ntimer:startNow()\n```",
"params": [],
"returns": [],
"function_type": "method",
"source": {
"line": 115,
"path": "src/Timer/init.luau"
}
},
{
"name": "stop",
"desc": "Stops the timer. Will do nothing if the timer is already stopped.\n\n```lua\ntimer:stop()\n```",
"params": [],
"returns": [],
"function_type": "method",
"source": {
"line": 131,
"path": "src/Timer/init.luau"
}
},
{
"name": "interval",
"desc": "Returns the timer's tick interval.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "number\n"
}
],
"function_type": "method",
"source": {
"line": 142,
"path": "src/Timer/init.luau"
}
},
{
"name": "running",
"desc": "Returns `true` if the timer is currently running.\n\n```lua\nif timer:running() then\n\t-- Do something\nend\n```",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "method",
"source": {
"line": 156,
"path": "src/Timer/init.luau"
}
},
{
"name": "destroy",
"desc": "Destroys the timer. This will also stop the timer.",
"params": [],
"returns": [],
"function_type": "method",
"source": {
"line": 163,
"path": "src/Timer/init.luau"
}
}
],
"properties": [
{
"name": "onTicked",
"desc": "The event which is fired every time the timer hits its interval.",
"lua_type": "Signal <timerDelta: number>",
"source": {
"line": 29,
"path": "src/Timer/init.luau"
}
}
],
"types": [],
"name": "Timer",
"desc": "The Timer class allows for code to run periodically at specified intervals.\n\n```lua\nlocal timer = Timer.new(2)\ntimer.onTicked:Connect(function(tickDelta)\n\tprint(\"Tock\")\nend)\ntimer:start()\n```",
"source": {
"line": 14,
"path": "src/Timer/init.luau"
}
}