add tasker module description and samples
This commit is contained in:
3
samples/command-test.lua
Normal file
3
samples/command-test.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
function on_command(text)
|
||||
ui:show_text(txt)
|
||||
end
|
||||
19
samples/tasker-test.lua
Normal file
19
samples/tasker-test.lua
Normal 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
28
samples/tasker-test2.lua
Normal 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
10
samples/tasker-test3.lua
Normal 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
|
||||
Reference in New Issue
Block a user