--[=[
	Fires for the current key the given value
	@param key TKey
	@param ... TEmit
]=]

function ObservableSubscriptionTable:Fire(key, ...)
	assert(key ~= nil, "Bad key")

	local subs = self._subMap[key]
	if not subs then
		return
	end

	-- Make a copy so we don't have to worry about our last changing
	for _, sub in pairs(table.clone(subs)) do
		task.spawn(sub.Fire, sub, ...)
	end
end

function ObservableSubscriptionTable:Complete(key, ...)
	local subs = self._subMap[key]
	if not subs then
		return
	end

	local subsToComplete = table.clone(subs)
	self._subMap[key] = nil

	for _, sub in pairs(subsToComplete) do
		task.spawn(sub.Complete, sub, ...)
	end
end
