Activator event callback
Declaration
thread.register_event("xxtouch.activator_callback", function(val)
local ret = json.decode(val)
sys.toast("mode:"..ret.mode.."\n"
.."event:"..ret.event.."\n"
.."time:"..ret.time)
end)
State
- val
When Activator is configured for callbacks and a corresponding event is triggered, the event details are passed here.
Notes
Requires installing Activator and configuring it appropriately in Activator.
Example
-- Clear message queue
proc_queue_clear("xxtouch.activator_callback")
--
-- Start listening
local eid = thread.register_event("xxtouch.activator_callback", function(val)
local ret = json.decode(val)
if ret.event=="libactivator.statusbar.tap.double" then
sys.toast("Double-tap status bar callback")
end
end)
--
sys.msleep(20000) -- wait 20 seconds
--
-- Unregister callback; without unregistering, the script will not end here
thread.unregister_event("xxtouch.activator_callback", eid)
Note: Uses sys.toast
, sys.msleep
, proc_queue_clear
, thread.register_event
, thread.unregister_event