diff --git a/Bait.md b/Bait.md new file mode 100644 index 0000000..789bc03 --- /dev/null +++ b/Bait.md @@ -0,0 +1,29 @@ +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) +``` \ No newline at end of file