mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-13 15:48:00 +08:00
perf(spinners): handle none exist data
This commit is contained in:
parent
b0611b5330
commit
bdd44ddb27
@ -36,12 +36,20 @@ function M.Onframe(...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.stop()
|
function M.stop()
|
||||||
|
if M.timer_id then
|
||||||
vim.fn.timer_stop(M.timer_id)
|
vim.fn.timer_stop(M.timer_id)
|
||||||
|
M.timer_id = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if var is a function, then the function will be called with one argv
|
-- if var is a function, then the function will be called with one argv
|
||||||
function M.apply(name, var)
|
function M.apply(name, var)
|
||||||
local data = M._data[name] or {}
|
local data = M._data[name]
|
||||||
|
|
||||||
|
if not data then
|
||||||
|
log.debug('faile to apply spinners, no data named ' .. name)
|
||||||
|
return
|
||||||
|
end
|
||||||
local time = data.timeout or 80
|
local time = data.timeout or 80
|
||||||
M.index = 1
|
M.index = 1
|
||||||
M.spinners = M._data[name].frames
|
M.spinners = M._data[name].frames
|
||||||
|
Loading…
Reference in New Issue
Block a user