local g={}g.ClassName="\080\101\110\100\105\110\103\080\114\111\109\105\115\101\084\114\097\099\107\101\114"g.__index=g function g.new()local C=setmetatable({},g)C._pendingPromises={}return C end function g.Add(C,g)if g:IsPending()then C._pendingPromises[g]=true g:Finally(function()C._pendingPromises[g]=nil end)end end function g.GetAll(g)local C={}for g,Q in pairs(g._pendingPromises)do table.insert(C,g)end return C end return g
--- Tracks pending promises
-- @classmod PendingPromiseTracker

local PendingPromiseTracker = {}
PendingPromiseTracker.ClassName = "PendingPromiseTracker"
PendingPromiseTracker.__index = PendingPromiseTracker

function PendingPromiseTracker.new()
	local self = setmetatable({}, PendingPromiseTracker)

	self._pendingPromises = {}

	return self
end

function PendingPromiseTracker:Add(promise)
	if promise:IsPending() then
		self._pendingPromises[promise] = true
		promise:Finally(function()
			self._pendingPromises[promise] = nil
		end)
	end
end

function PendingPromiseTracker:GetAll()
	local promises = {}
	for promise, _ in pairs(self._pendingPromises) do
		table.insert(promises, promise)
	end
	return promises
end

return PendingPromiseTracker