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

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
