Chuyển tới nội dung chính

Lệnh gọi lại sự kiện Activator

Khai báo

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)

Trạng thái

  • val
    Khi Activator được cấu hình để gọi lại và một sự kiện tương ứng được kích hoạt, thông tin chi tiết của sự kiện sẽ được truyền vào đây.

Mô tả

Yêu cầu cài đặt Activator và cấu hình phù hợp trong Activator.

Ví dụ

-- Xóa hàng đợi thông báo
proc_queue_clear("xxtouch.activator_callback")
--
-- Bắt đầu lắng nghe
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("Lệnh gọi lại khi nhấn đúp thanh trạng thái")
end
end)
--
sys.msleep(20000) -- chờ 20 giây
--
-- Hủy đăng ký lệnh gọi lại; nếu không hủy, tập lệnh sẽ không kết thúc tại đây
thread.unregister_event("xxtouch.activator_callback", eid)

Lưu ý: Sử dụng sys.toast, sys.msleep, proc_queue_clear, thread.register_event, thread.unregister_event