{"id":"vocksel/timer","name":"timer","scope":"vocksel","platform":"roblox","description":"Timer class based off of Godot's Timer","version":"0.1.1","latest":"0.1.1","versions":["0.1.0","0.1.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"d32a5e36d5b2df5b7a1d66bf136b1287c07e95e9bf470c110ceed995db88a7d4","likes":0,"downloads":0,"install":"forest install vocksel/timer","url":"https://forest.dev/p/roblox/vocksel/timer","files":"https://api.forest.dev/ai/package/roblox/vocksel/timer/files","readme":"# Timer\n\nSimple Timer class for easy asynchronous time keeping.\n\n```lua\nlocal timer = Timer.new(2)\n\ntimer.Timeout:Connect(function()\n    print(\"Timer elapsed after\", timer.Duration, \"seconds\")\nend)\n\ntimer:Start()\n```\n\n## Constructors\n\n**Timer.new(duration: number)**\n\nCreates a new Timer instance, which when started, will elapse after `duration`\nseconds.\n\n## Properties\n\n**Timer.Duration: number (readonly)**\n\nThe duration (in seconds) that the timer runs for. This is the value passed in\nwhen constructing.\n\n**Timer.IsRunning: boolean (readonly)**\n\nSimple flag to keep track of if the Timer is currently running or not.\n\n**Timer.IsLooped: boolean**\n\nSets whether the Timer will automatically start itself again after elapsing.\nThis is the same as calling Start() each time Timeout is fired.\n\n## Methods\n\n**Timer:Start()**\n\nStarts the timer.\n\nIf the timer is already running, this will reset the current duration. This\nbehavior is a bit weird, but allows you to do some neat tricks. For example, a\ncooldown mechanic, where a weapon will only go on cooldown once the user stops\nperforming a chain of attacks.\n\n**Timer:Stop()**\n\nStops the Timer, preventing Timeout from firing.\n\n**Timer:Destroy()**\n\nDestroys the current timer and all of its instances.\n\n## Events\n\n**Timer.Timeout**\n\nThis event gets fired when the Timer elapses after being started with Start().\nNo arguments are passed to it.\n","readmeTruncated":false}