--[=[
	@param object T
	Add an object to the queue.
]=]

function TaskQueue:Add<T>(object: T)
	table.insert(self._queue, object)
	if not self._flushingScheduled then
		self._flushingScheduled = true
		task.defer(function()
			if not self._flushingScheduled then
				return
			end
			self._flushing = true
			self._onFlush(self._queue)
			table.clear(self._queue)
			self._flushing = false
			self._flushingScheduled = false
		end)
	end
end

