mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update annotations: back_handler and blocker
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
--- Component to handle back key (android, backspace)
|
||||
-- @module druid.back_handler
|
||||
-- @module BackHandler
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.back_handler
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
-- @tfield druid_event on_back On back handler callback
|
||||
--- On back handler callback(self, params)
|
||||
-- @tfield druid_event on_back
|
||||
|
||||
--- Params to back callback
|
||||
-- @tfield any params
|
||||
|
||||
--- Component fields
|
||||
-- @table Fields
|
||||
-- @tfield any params Params to click callbacks
|
||||
|
||||
local Event = require("druid.event")
|
||||
local const = require("druid.const")
|
||||
@@ -17,21 +18,20 @@ local BackHandler = component.create("back_handler", { const.ON_INPUT })
|
||||
|
||||
|
||||
--- Component init function
|
||||
-- @function back_handler:init
|
||||
-- @tparam BackHandler self
|
||||
-- @tparam callback callback On back button
|
||||
-- @tparam[opt] params Callback argument
|
||||
function BackHandler:init(callback, params)
|
||||
-- @tparam[opt] any params Callback argument
|
||||
function BackHandler.init(self, callback, params)
|
||||
self.params = params
|
||||
|
||||
self.on_back = Event(callback)
|
||||
end
|
||||
|
||||
|
||||
--- Input handler for component
|
||||
-- @function back_handler:on_input
|
||||
-- @tparam BackHandler self
|
||||
-- @tparam string action_id on_input action id
|
||||
-- @tparam table action on_input action
|
||||
function BackHandler:on_input(action_id, action)
|
||||
function BackHandler.on_input(self, action_id, action)
|
||||
if not action[const.RELEASED] then
|
||||
return false
|
||||
end
|
||||
|
Reference in New Issue
Block a user