function Promise.defer(N)local H=debug.traceback(nil,2)local W W=Promise._new(H,function(W,r,a)task.defer(function()local g,X,x=runExecutor(H,N,W,r,a)if not g then r(x[1])end end)end)return W end

function Promise.defer(executor)
	local traceback = debug.traceback(nil, 2)
	local promise
	promise = Promise._new(traceback, function(resolve, reject, onCancel)
		task.defer(function()
			local ok, _, result = runExecutor(traceback, executor, resolve, reject, onCancel)

			if not ok then
				reject(result[1])
			end
		end)
	end)

	return promise
end
