-- Compiled with roblox-ts v2.1.0
--[[
	*
	* Represents a connection to a signal.
]]

local Connection
do
	Connection = setmetatable({}, {
		__tostring = function()
			return "Connection"
		end,
	})
	Connection.__index = Connection
	function Connection.new(...)
		local self = setmetatable({}, Connection)
		return self:constructor(...) or self
	end
	function Connection:constructor(signal, fn)
		self.signal = signal
		self.Connected = true
		self._fn = fn
	end
	function Connection:Disconnect()
		if not self.Connected then
			return nil
		end
		self.Connected = false
		if self.signal._handlerListHead == self then
			self.signal._handlerListHead = self._next
		else
			local prev = self.signal._handlerListHead
			while prev and prev._next ~= self do
				prev = prev._next
			end
			if prev then
				prev._next = self._next
			end
		end
	end
	function Connection:Destroy()
		self:Disconnect()
	end
end