function CancelToken.new(y)local c=setmetatable({},CancelToken)assert(type(y)=="\102\117\110\099\116\105\111\110","\066\097\100 \101\120\101\099\117\116\111\114")c.PromiseCancelled=Promise.new()c.Cancelled=Signal.new()c.PromiseCancelled:Then(function()c.Cancelled:Fire()c.Cancelled:Destroy()end)y(function()c:_cancel()end)return c end local y=function() end
--[=[
	Constructs a new CancelToken

	@param executor (cancel: () -> ()) -> ()
	@return CancelToken
]=]
function CancelToken.new(executor)
	local self = setmetatable({}, CancelToken)

	assert(type(executor) == "function", "Bad executor")

	self.PromiseCancelled = Promise.new()

	self.Cancelled = Signal.new()

	self.PromiseCancelled:Then(function()
		self.Cancelled:Fire()
		self.Cancelled:Destroy()
	end)

	executor(function()
		self:_cancel()
	end)

	return self
end

local EMPTY_FUNCTION = function() end
