plugins: api.customApiCall
Massimo Melina committed
Jun 4, 2023 at 12:28 UTC
a2f8891117ae0d4368798f4c971e83343c98db15
2 files changed
+7
-1
dev-plugins.md
+4
-1
@@ -150,6 +150,9 @@ The `api` object you get as parameter of the `init` contains the following:
150
If you need something for your plugin that's not covered by `api`, you can test it with this method, but you should
151
then discuss it on the forum because an addition to `api` is your best option for making a future-proof plugin.
152
153
+- `customApiCall: (method: string, params?: object) => any[]` this will invoke other plugins if they define `method`
154
+ exported inside `customApi: object`
155
+
156
## Front-end specific
157
158
The following information applies to the default front-end, and may not apply to a custom one.
@@ -292,7 +295,7 @@ HFS will scan through them in inverted alphabetical order searching for a compat
295
- entry.getNext, getPrevious, getNextFiltered, getPreviousFiltered, getDefaultIcon
296
- platform-dependent distribution
297
- HFS.watchState, emit
295
- - api.storageDir
298
+ - api.storageDir, customApiCall
299
- 8.1 (v0.45.0) should have been 0.44.0 but forgot to update number
300
- full URL support for frontend_js and frontend_css
301
- custom.html
src/plugins.ts
+3
@@ -349,6 +349,9 @@ function watchPlugin(id: string, path: string) {
349
})
350
},
351
getHfsConfig: getConfig,
352
+ customApiCall(method: string, params?: any) {
353
+ return mapPlugins(pl => pl.getData().customApi?.[method]?.(params))
354
+ }
355
})
356
const folder = dirname(module)
357
Object.assign(data, res, {