add notify, files and utils modules documentation

This commit is contained in:
Evgeny
2021-11-26 20:22:52 +03:00
parent b620780482
commit 4c7e9dfe41
4 changed files with 128 additions and 2 deletions

6
samples/files_sample.lua Normal file
View File

@@ -0,0 +1,6 @@
function on_resume()
files:delete("abc.txt")
files:write_text("abc.txt", "This is text")
local string = files:read_text("abc.txt")
ui:show_text(string)
end

38
samples/notify_sample.lua Normal file
View File

@@ -0,0 +1,38 @@
local curr_notab = {}
local curr_titletab = {}
local curr_keystab = {}
function on_resume()
notify:get_current()
end
function on_notify_posted(n)
curr_notab[n.key] = n
redraw()
end
function on_notify_removed(n)
curr_notab[n.key] = nil
redraw()
ui:show_toast("Notify from "..n.package.." removed")
end
function redraw()
fill_tabs(curr_notab)
ui:show_lines(curr_titletab)
end
function on_click(i)
notify:open(curr_keystab[i])
end
function fill_tabs(tab)
curr_titletab = {}
curr_keystab = {}
for k,v in pairs(tab) do
table.insert(curr_titletab, v.title)
table.insert(curr_keystab, v.key)
end
end