mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-25 08:54:50 +01:00
fix: get promise value in timer, schedule cb
This commit is contained in:
parent
ecf58046b5
commit
d98f6707d0
1 changed files with 2 additions and 1 deletions
|
@ -22,7 +22,8 @@ local function async_poller(generator, callback)
|
||||||
timer:start(500, 500, function()
|
timer:start(500, 500, function()
|
||||||
if promise == nil then promise = generator() end
|
if promise == nil then promise = generator() end
|
||||||
if promise.ready then
|
if promise.ready then
|
||||||
vim.schedule(function() callback(promise:await()) end)
|
local res = promise:await()
|
||||||
|
vim.schedule(function() callback(res) end)
|
||||||
promise = nil
|
promise = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue