Compare commits

...

3 Commits

Author SHA1 Message Date
TorchedSammy 09d04a7850 docs: [ci] generate new docs 2022-12-02 00:05:24 +00:00
TorchedSammy 4df37b4341
chore: merge from upstream 2022-12-01 20:04:55 -04:00
TorchedSammy 5e2b3367de
docs(bait): add annotation strings for release and hooks functions 2022-12-01 20:04:24 -04:00
2 changed files with 10 additions and 2 deletions

View File

@ -13,12 +13,16 @@ function bait.catch(name, cb) end
function bait.catchOnce(name, cb) end function bait.catchOnce(name, cb) end
--- Returns a table with hooks on the event with `name`. --- Returns a table with hooks on the event with `name`.
function bait.hooks() end --- @param name string
--- @returns table
function bait.hooks(name) end
--- Removes the `catcher` for the event with `name` --- Removes the `catcher` for the event with `name`
--- For this to work, `catcher` has to be the same function used to catch --- For this to work, `catcher` has to be the same function used to catch
--- an event, like one saved to a variable. --- an event, like one saved to a variable.
function bait.release() end --- @param name string
--- @param catcher function
function bait.release(name, catcher) end
--- Throws a hook with `name` with the provided `args` --- Throws a hook with `name` with the provided `args`
--- @param name string --- @param name string

View File

@ -286,6 +286,8 @@ func (b *Bait) bcatchOnce(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
// Removes the `catcher` for the event with `name` // Removes the `catcher` for the event with `name`
// For this to work, `catcher` has to be the same function used to catch // For this to work, `catcher` has to be the same function used to catch
// an event, like one saved to a variable. // an event, like one saved to a variable.
// --- @param name string
// --- @param catcher function
func (b *Bait) brelease(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { func (b *Bait) brelease(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
name, catcher, err := util.HandleStrCallback(t, c) name, catcher, err := util.HandleStrCallback(t, c)
if err != nil { if err != nil {
@ -299,6 +301,8 @@ func (b *Bait) brelease(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
// hooks(name) -> {cb, cb...} // hooks(name) -> {cb, cb...}
// Returns a table with hooks on the event with `name`. // Returns a table with hooks on the event with `name`.
// --- @param name string
// --- @returns table
func (b *Bait) bhooks(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { func (b *Bait) bhooks(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
if err := c.Check1Arg(); err != nil { if err := c.Check1Arg(); err != nil {
return nil, err return nil, err