sync: add on_complete callback -- taken from trsdln on github
This commit is contained in:
10
lua/dep.lua
10
lua/dep.lua
@ -548,7 +548,7 @@ local function sync(package, cb)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sync_list(list)
|
local function sync_list(list, on_complete)
|
||||||
local progress = 0
|
local progress = 0
|
||||||
local has_errors = false
|
local has_errors = false
|
||||||
|
|
||||||
@ -565,6 +565,10 @@ local function sync_list(list)
|
|||||||
else
|
else
|
||||||
logger:log("update", string.format("synchronized %s %s", #list, #list == 1 and "package" or "packages"))
|
logger:log("update", string.format("synchronized %s %s", #list, #list == 1 and "package" or "packages"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if on_complete then
|
||||||
|
on_complete()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -819,8 +823,8 @@ end
|
|||||||
|
|
||||||
--todo: prevent multiple execution of async routines
|
--todo: prevent multiple execution of async routines
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
sync = wrap_api("dep.sync", function()
|
sync = wrap_api("dep.sync", function(on_complete)
|
||||||
sync_list(packages)
|
sync_list(packages, on_complete)
|
||||||
end),
|
end),
|
||||||
|
|
||||||
reload = wrap_api("dep.reload", reload_all),
|
reload = wrap_api("dep.reload", reload_all),
|
||||||
|
Reference in New Issue
Block a user