mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-22 17:05:42 +08:00
perf(spinners): handle spinners function error
This commit is contained in:
parent
24803f4de0
commit
b0611b5330
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
local log = require('spacevim.logger').derive('spinners')
|
||||||
|
|
||||||
M._data = {
|
M._data = {
|
||||||
dot1 = {
|
dot1 = {
|
||||||
frames = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' },
|
frames = { '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' },
|
||||||
@ -24,7 +26,13 @@ function M.Onframe(...)
|
|||||||
else
|
else
|
||||||
M.index = 1
|
M.index = 1
|
||||||
end
|
end
|
||||||
M.func(M.spinners[M.index])
|
if type(M.func) == 'function' then
|
||||||
|
local ok, err = pcall(M.func, M.spinners[M.index])
|
||||||
|
if not ok then
|
||||||
|
log.debug('failed to call spinners functions:\n')
|
||||||
|
log.debug(err)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.stop()
|
function M.stop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user