add tasker module description and samples

This commit is contained in:
Evgeny
2022-06-10 07:33:22 +03:00
parent f661a31b7b
commit 17317c9247
5 changed files with 85 additions and 1 deletions

3
samples/command-test.lua Normal file
View File

@@ -0,0 +1,3 @@
function on_command(text)
ui:show_text(txt)
end

19
samples/tasker-test.lua Normal file
View File

@@ -0,0 +1,19 @@
local tasks = {}
function on_resume()
tasks = tasker:get_tasks()
ui:show_lines(tasks)
end
function on_click(idx)
tasker:run_task(tasks[idx])
end
-- Optional
function on_task_result(success)
if success then
ui:show_toast("Successfull!")
else
ui:show_toast("Failed!")
end
end

28
samples/tasker-test2.lua Normal file
View File

@@ -0,0 +1,28 @@
local names = {
"Open AIO Launcher site",
"Copy to clipboard",
"Wait 2 seconds and enable flashlight",
}
local tasks = {
"VIEW_URL http://aiolauncher.app '' false ''",
"SET_CLIPBOARD 'Text to copy' false ''",
"WAIT 0 2 0 0 0; TORCH true",
}
function on_resume()
ui:show_lines(names)
end
function on_click(idx)
tasker:run_own_task(tasks[idx])
end
-- Optional
function on_task_result(success)
if success then
ui:show_toast("Successfull!")
else
ui:show_toast("Failed!")
end
end

10
samples/tasker-test3.lua Normal file
View File

@@ -0,0 +1,10 @@
function on_resume()
ui:show_text("Click me")
end
function on_click()
tasker:run_task("Test", {
firstname = "John",
lastname = "Doe",
})
end