1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 10:00:04 +08:00

chore(spinners): change file format

This commit is contained in:
wsdjeg 2023-09-05 21:15:18 +08:00
parent caa371fae4
commit ffe3f332a1

View File

@ -1,44 +1,52 @@
local M = {} --=============================================================================
-- spinners.lua --- spinners api
M._data = { -- Copyright (c) 2016-2022 Wang Shidong & Contributors
dot1 = { -- Author: Wang Shidong < wsdjeg@outlook.com >
frames = { '', '', '', '', '', '', '', '', '', '' }, -- URL: https://spacevim.org
strwidth = 1, -- License: GPLv3
timeout = 80, --=============================================================================
},
} local M = {}
M._id = 0 M._data = {
dot1 = {
function M.Onframe(...) frames = { '', '', '', '', '', '', '', '', '', '' },
if M.index < #M.spinners then strwidth = 1,
M.index = M.index + 1 timeout = 80,
else },
M.index = 1 }
end
M.func(M.spinners[M.index]) M._id = 0
end
function M.Onframe(...)
function M.stop() if M.index < #M.spinners then
vim.fn.timer_stop(M.timer_id) M.index = M.index + 1
end else
M.index = 1
-- if var is a function, then the function will be called with one argv end
function M.apply(name, var) M.func(M.spinners[M.index])
local data = M._data[name] or {} end
local time = data.timeout or 80
M.index = 1 function M.stop()
M.spinners = M._data[name].frames vim.fn.timer_stop(M.timer_id)
if type(var) == 'function' then end
M.func = var
M.func(M.spinners[M.index]) -- if var is a function, then the function will be called with one argv
end function M.apply(name, var)
M.timer_id = vim.fn.timer_start(time, M.Onframe, { ['repeat'] = -1 }) local data = M._data[name] or {}
return { M.timer_id, M._data[name].strwidth } local time = data.timeout or 80
end M.index = 1
M.spinners = M._data[name].frames
function M.get_str() if type(var) == 'function' then
return M.str M.func = var
end M.func(M.spinners[M.index])
end
return M M.timer_id = vim.fn.timer_start(time, M.Onframe, { ['repeat'] = -1 })
return { M.timer_id, M._data[name].strwidth }
end
function M.get_str()
return M.str
end
return M