--[[
	Spawns a thread with predictable timing.
]]

function Promise.spawn(callback, ...)
	local args = { ... }
	local length = select("#", ...)

	local connection
	connection = RunService.Heartbeat:Connect(function()
		connection:Disconnect()
		callback(unpack(args, 1, length))
	end)
end
