mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-29 17:03:23 +00:00
Destroyed Bait (markdown)
parent
502fb03244
commit
10faacaaa4
29
Bait.md
29
Bait.md
@ -1,29 +0,0 @@
|
|||||||
Bait is the event emitter for Hilbish. Why name it bait? Because it throws hooks that you can catch.
|
|
||||||
(emits events that you can listen to) and because why not, fun naming is fun.
|
|
||||||
This is what you will use if you want to listen in on hooks to know when certain things have happened, like when you've changed directory, a command has failed, etc.
|
|
||||||
To require:
|
|
||||||
```lua
|
|
||||||
local bait = require 'bait'
|
|
||||||
```
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
### Bait.throw(hookname, args)
|
|
||||||
|
|
||||||
Throws (emits) a new hook to catch.
|
|
||||||
`args` is the arguments that will be provided to the `hookfunc` in `Bait.catch`
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
```lua
|
|
||||||
bait.throw('hello', 'world!')
|
|
||||||
```
|
|
||||||
|
|
||||||
### Bait.catch(hookname, hookfunc)
|
|
||||||
|
|
||||||
Binds a new hook named `hookname` to `hookfunc`.
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
```lua
|
|
||||||
bait.catch('hello', function(name)
|
|
||||||
print('Hello ' .. name .. '!')
|
|
||||||
end)
|
|
||||||
```
|
|
Loading…
x
Reference in New Issue
Block a user