Add profiles module docs and samples
This commit is contained in:
13
samples/profiles_sample1.lua
Normal file
13
samples/profiles_sample1.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
-- This sample lists current system profiles and allows to restore any of it
|
||||
|
||||
profs = {}
|
||||
|
||||
function on_resume()
|
||||
profs = profiles:list()
|
||||
ui:show_lines(profiles:list())
|
||||
end
|
||||
|
||||
function on_click(idx)
|
||||
ui:show_toast("Restoring...")
|
||||
profiles:restore(profs[idx])
|
||||
end
|
||||
20
samples/profiles_sample2.lua
Normal file
20
samples/profiles_sample2.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
-- This script shows how to dump/restore profile without saving it to the system
|
||||
|
||||
curr_profile = ""
|
||||
|
||||
function on_resume()
|
||||
ui:show_lines{
|
||||
"Dump profile",
|
||||
"Restore profile"
|
||||
}
|
||||
end
|
||||
|
||||
function on_click(idx)
|
||||
if idx == 1 then
|
||||
curr_profile = profiles:dump_json()
|
||||
ui:show_toast("Saved")
|
||||
else
|
||||
ui:show_toast("Restoring...")
|
||||
profiles:restore_json(curr_profile)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user