Skip to content

Commit

Permalink
feat(release-0.0.1): has tests and readme, release-worthy?
Browse files Browse the repository at this point in the history
  • Loading branch information
BirdeeHub committed Aug 31, 2024
1 parent 9bf3769 commit c07c96d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ Again, this is important:
| Property | Type | Description |
| --- | --- | --- |
| spec_field | `string` | the `lze.PluginSpec` field used to configure the handler |
| add | `fun(plugin: lze.Plugin)` | called once for each handler before any plugin has been loaded. Tells your handler about each plugin so you can set up a trigger for it if you handler was used. |
| add? | `fun(plugin: lze.Plugin)` | called once for each handler before any plugin has been loaded. Tells your handler about each plugin so you can set up a trigger for it if you handler was used. |
| before? | `fun(name: string)` | called after each plugin spec's before `hook`, and before its `load` hook |
| after? | `fun(name: string)` | called after each plugin spec's `load` hook and before its `after` hook |
| modify? | `fun(name: string): lze.Plugin` | This function is called before a plugin is added to state. It is your one chance to modify the plugin spec, it is active only if your spec_field was used in that spec, and is called in the order the handlers have been added. |
Expand All @@ -601,7 +601,8 @@ Then, your handler will have a chance to add plugins to its list to trigger,
via its `add` function, which is called before any plugins have been loaded
in that `require('lze').load` call.

You can manually load a plugin and run its associated hooks
Your handler will then decide when to load
a plugin and run its associated hooks
using the `trigger_load` function.

```lua
Expand All @@ -616,6 +617,9 @@ For debugging purposes, or if necessary, you may use `require('lze').query_state
which will return a copy of the state of the plugin, false if loaded or being loaded,
and nil if it was never added.

It *copies* the value from state, so avoid using it unnecessarily,
you should already have the value from your add function!

> [!TIP]
> You should delete the plugin from your handler's state
> in either the `before` or `after` hooks
Expand Down
2 changes: 1 addition & 1 deletion lua/lze/meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ error("Cannot import a meta module")
---@class lze.Handler
---@field spec_field string
---@field modify? fun(plugin: lze.Plugin): lze.Plugin
---@field add fun(plugin: lze.Plugin)
---@field add? fun(plugin: lze.Plugin)
---
---runs at the end of require('lze').load()
---for handlers to set up extra triggers such as the
Expand Down

0 comments on commit c07c96d

Please sign in to comment.