rbx-timeout
v1.0.7
Published
setTimeout and setInterval for roblox-ts.
Downloads
13
Readme
rbx-timeout
setTimeout and setInterval for roblox-ts.
Examples
Using rbx-timeout with setTimeout
import { setTimeout } from "rbx-timeout"
const timeout = setTimeout(() => {
print("This will print in 1000 milliseconds (1 second).")
}, 1000)
Using rbx-timeout with clearTimeout
import { setTimeout, clearTimeout } from "rbx-timeout"
const timeout = setTimeout(() => {
print("This will NOT print in 1000 milliseconds (1 second).")
}, 1000)
clearTimeout(timeout)
Using rbx-timeout with setInterval
import { setInterval } from "rbx-timeout"
const interval = setInterval(() => {
print("This will continue to print every 1000 milliseconds.")
}, 1000)
Using rbx-timeout with clearInterval
import { setInterval, clearInterval } from "rbx-timeout"
const interval = setInterval(() => {
print("This is now functionally equivalent to setTimeout.")
clearInterval(interval)
}, 1000)
Using rbx-timeout with classes
import { Timeout } from "rbx-timeout"
const timeout = new Timeout(() => {
print("This will not print")
}, 1000) // equivalent to setTimeout
timeout.clear() // equivalent to clearTimeout
import { Interval } from "rbx-timeout"
const interval = new Interval(() => {
print("This will not print")
}, 1000) // equivalent to setInterval
interval.clear() // equivalent to clearInterval