mirror of
https://github.com/Insality/druid.git
synced 2025-09-28 10:32:20 +02:00
Add example docs for LDoc
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
--- Component to handle back key
|
||||
-- @module base.back_handler
|
||||
|
||||
local data = require("druid.data")
|
||||
|
||||
local M = {}
|
||||
@@ -5,21 +8,25 @@ M.interest = {
|
||||
data.ON_INPUT
|
||||
}
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @tparam table self component instance
|
||||
-- @tparam callback callback on back button
|
||||
-- @tparam[opt] params callback argument
|
||||
function M.init(self, callback, params)
|
||||
self.event = data.A_ANDR_BACK
|
||||
self.event = data.ACTION_BACK
|
||||
self.callback = callback
|
||||
self.params = params
|
||||
end
|
||||
|
||||
|
||||
--- input handler
|
||||
-- @param action_id - input action id
|
||||
-- @param action - input action
|
||||
--- Input handler for component
|
||||
-- @tparam string action_id on_input action id
|
||||
-- @tparam table action on_input action
|
||||
function M.on_input(self, action_id, action)
|
||||
if action[data.RELEASED] then
|
||||
self.callback(self.parent.parent, self.params)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user