doc(@supermodule): gears.object inheritable doc
This commit is contained in:
parent
b82d2a690f
commit
3a6fa10754
|
@ -46,9 +46,11 @@ function object.add_signal()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Connect to a signal.
|
--- Connect to a signal.
|
||||||
|
--
|
||||||
--@DOC_text_gears_object_signal_EXAMPLE@
|
--@DOC_text_gears_object_signal_EXAMPLE@
|
||||||
-- @tparam string name The name of the signal
|
--
|
||||||
-- @tparam function func The callback to call when the signal is emitted
|
-- @tparam string name The name of the signal.
|
||||||
|
-- @tparam function func The callback to call when the signal is emitted.
|
||||||
-- @method connect_signal
|
-- @method connect_signal
|
||||||
function object:connect_signal(name, func)
|
function object:connect_signal(name, func)
|
||||||
assert(type(func) == "function", "callback must be a function, got: " .. type(func))
|
assert(type(func) == "function", "callback must be a function, got: " .. type(func))
|
||||||
|
@ -92,10 +94,16 @@ local function make_the_gc_obey(func)
|
||||||
return func
|
return func
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Connect to a signal weakly. This allows the callback function to be garbage
|
--- Connect to a signal weakly.
|
||||||
-- collected and automatically disconnects the signal when that happens.
|
--
|
||||||
-- @tparam string name The name of the signal
|
-- This allows the callback function to be garbage collected and
|
||||||
-- @tparam function func The callback to call when the signal is emitted
|
-- automatically disconnects the signal when that happens.
|
||||||
|
-- **Warning:**
|
||||||
|
-- Only use this function if you really, really, really know what you
|
||||||
|
-- are doing.
|
||||||
|
--
|
||||||
|
-- @tparam string name The name of the signal.
|
||||||
|
-- @tparam function func The callback to call when the signal is emitted.
|
||||||
-- @method weak_connect_signal
|
-- @method weak_connect_signal
|
||||||
function object:weak_connect_signal(name, func)
|
function object:weak_connect_signal(name, func)
|
||||||
assert(type(func) == "function", "callback must be a function, got: " .. type(func))
|
assert(type(func) == "function", "callback must be a function, got: " .. type(func))
|
||||||
|
@ -104,9 +112,9 @@ function object:weak_connect_signal(name, func)
|
||||||
sig.weak[func] = make_the_gc_obey(func)
|
sig.weak[func] = make_the_gc_obey(func)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Disonnect to a signal.
|
--- Disonnect from a signal.
|
||||||
-- @tparam string name The name of the signal
|
-- @tparam string name The name of the signal.
|
||||||
-- @tparam function func The callback that should be disconnected
|
-- @tparam function func The callback that should be disconnected.
|
||||||
-- @method disconnect_signal
|
-- @method disconnect_signal
|
||||||
function object:disconnect_signal(name, func)
|
function object:disconnect_signal(name, func)
|
||||||
local sig = find_signal(self, name)
|
local sig = find_signal(self, name)
|
||||||
|
@ -118,8 +126,8 @@ end
|
||||||
--
|
--
|
||||||
-- @tparam string name The name of the signal
|
-- @tparam string name The name of the signal
|
||||||
-- @param ... Extra arguments for the callback functions. Each connected
|
-- @param ... Extra arguments for the callback functions. Each connected
|
||||||
-- function receives the object as first argument and then any extra arguments
|
-- function receives the object as first argument and then any extra
|
||||||
-- that are given to emit_signal()
|
-- arguments that are given to emit_signal()
|
||||||
-- @method emit_signal
|
-- @method emit_signal
|
||||||
function object:emit_signal(name, ...)
|
function object:emit_signal(name, ...)
|
||||||
local sig = find_signal(self, name)
|
local sig = find_signal(self, name)
|
||||||
|
|
Loading…
Reference in New Issue