fix(docs): Update Guides documentation 2
This commit is contained in:
parent
d0415b33a5
commit
7cb6f11882
31 changed files with 81 additions and 81 deletions
|
@ -15,7 +15,7 @@ A FreeSewing plugin can extend FreeSewing in 3 different ways:
|
|||
We have [a list of plugins](/reference/plugins/) that we maintain, but
|
||||
if you can't find what you're looking for, you can write your own plugin.
|
||||
|
||||
If you plan on doing that, or if you would like to understand how plugins work,
|
||||
If you plan on doing that or if you would like to understand how plugins work,
|
||||
this guide is for you.
|
||||
|
||||
We'll cover the following topics:
|
||||
|
|
|
@ -9,7 +9,7 @@ lifecycle.
|
|||
## Signature
|
||||
|
||||
To provide one or more hooks, your plugin should have a `hooks` property that
|
||||
is an object where the keys are the lifecycle hook name, and the value holds a
|
||||
is an object where the keys are the lifecycle hook name and the value holds a
|
||||
method. When the lifecycle hook is triggered, your method will be called.
|
||||
|
||||
```mjs
|
||||
|
|
|
@ -3,7 +3,8 @@ title: Loading plugins
|
|||
order: 140
|
||||
---
|
||||
|
||||
Plugins can be loaded at build time and added to the design. Or at run time and added to an instantiated pattern.
|
||||
Plugins can be loaded at build time and added to the design.
|
||||
Or, they can be added at run time and added to an instantiated pattern.
|
||||
|
||||
To load a plugin at build time, it should be added to [the `plugins` key of the part configuration](/reference/api/part/config/plugins).
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ const myPlugin = {
|
|||
All macros receive two arguments:
|
||||
|
||||
- `so`: A plain object holding configuration object passed to the macro
|
||||
- `props`: The same object as passed to the Part.draft()` method that you can destructure
|
||||
- `props`: The same object as passed to the [`Part.draft()`](/reference/api/part/draft) method that you can destructure
|
||||
|
||||
<Note>
|
||||
###### Macros take only 1 argument
|
||||
|
|
|
@ -40,16 +40,17 @@ All store methods receive at least two arguments:
|
|||
## Overwriting store methods
|
||||
|
||||
You are allowed to overwrite existing store methods.
|
||||
As it happens, this is how you should implement a custom logging solution, but overwriting the logging methods under the store's `log` key,
|
||||
As it happens, this is how you should implement a custom logging solution,
|
||||
by overwriting the logging methods under the store's `log` key,
|
||||
|
||||
However, the following methods cannot be overwritten:
|
||||
However, the following store methods cannot be overwritten:
|
||||
|
||||
- `extend`
|
||||
- `get`
|
||||
- `push`
|
||||
- `set`
|
||||
- `setIfUnset`
|
||||
- `unset`
|
||||
- `extend()`
|
||||
- `get()`
|
||||
- `push()`
|
||||
- `set()`
|
||||
- `setIfUnset()`
|
||||
- `unset()`
|
||||
|
||||
## Return value
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ Object plugin = {
|
|||
A plugin **must** have the `name` and `version` properties.
|
||||
The other properties are optional, and they map to the three different functionalities macros can provide:
|
||||
|
||||
- `hooks`: Holds an object with lifecycle hooks the plugin wants to hook into
|
||||
- `macros`: Holds and object with macros the plugin provides
|
||||
- `store`: Holds and Array with store methods the plugin provides.
|
||||
- [`hooks`](/guides/plugins/hooks): Holds an object with lifecycle hooks the plugin wants to hook into
|
||||
- [`macros`](/guides/plugins/macros): Holds and object with macros the plugin provides
|
||||
- [`store`](/guides/plugins/store): Holds and Array with store methods the plugin provides.
|
||||
|
||||
Click on the links above for more details on the structure of these properties.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue