@samitouri / QOSami-HFS / commits / 4e6af241

doc: example

Massimo Melina committed Jan 26, 2025 at 09:53 UTC 4e6af241b4a6f10bd7220d769dc92877f91afe1f
1 file changed +9 -1
dev-plugins.md
+9 -1
@@ -147,6 +147,13 @@ used must be strictly JSON (thus, no single quotes, only double quotes for strin
147 - `onFrontendConfig: (config: object) => void | object` manipulate config values exposed to frontend.
148 - `customHtml: object | () => object` return custom-html sections programmatically.
149 - `customRest: { [name]: (parameters: object) => any }` declare backend functions to be called by frontend with `HFS.customRestCall`
150 + E.g.
151 + ```js
152 + exports.customRest = {
153 + myCommand({ text }) { console.log(text) }
154 + }
155 + // then, in the frontend yon can call HFS.customRestCall('myCommand', { text: 'hello' })
156 + ```
157 - `customApi: { [name]: (parameters) => any }` declare functions to be called by other plugins (only backend, not frontend) using `api.customApiCall` (documented below)
158
159 ### FieldDescriptor
@@ -156,7 +163,8 @@ A FieldDescriptor is an object and can be empty. Currently, these optional prope
163 - `label: string` what name to display next to the field. Default is based on `key`.
164 - `defaultValue: any` value to be used when nothing is set. Default is undefined.
165 - `helperText: string` extra text printed next to the field.
159 -- `showIf: (values: object) => boolean` only show this field if the function returns truthy. Must not reference variables of the outer scope.
166 +- `showIf: (values: object) => boolean` only show this field if the function returns truthy.
167 + Must not reference variables of the outer scope. [See example](https://github.com/rejetto/rich-folder/blob/main/dist/plugin.js).
168 - `frontend: boolean` expose this setting on the frontend, so that javascript can access it
169 using `HFS.getPluginConfig()[CONFIG_KEY]` but also css can access it as `var(--PLUGIN_NAME-CONFIG_KEY)`.
170 Hint: if you need to use a numeric config in CSS but you need to add a unit (like `em`),