added attach async

This commit is contained in:
Brian Shu 2021-01-05 11:26:03 -05:00 committed by Thomas Vigouroux
parent b441f257a4
commit e0b49a9a18
2 changed files with 14 additions and 1 deletions

View file

@ -141,4 +141,15 @@ function M.index_of(tbl, obj)
end
end
function M.async(f)
return function(...)
local handle
handle = vim.loop.new_async(vim.schedule_wrap(function(...)
f(...)
handle:close()
end))
handle:send(...)
end
end
return M