A platform for community discussion. Free, open, simple.
DEV: Improve JSDoc for withPluginApi (#29758)
David Taylorf70cc6215c18
diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.gjs b/app/assets/javascripts/discourse/app/lib/plugin-api.gjsindex 05c1f3603b8..2c3066b9433 100644--- a/app/assets/javascripts/discourse/app/lib/plugin-api.gjs+++ b/app/assets/javascripts/discourse/app/lib/plugin-api.gjs@@ -3362,7 +3362,6 @@ class PluginApi {registeredTabs.push(tab);}- // eslint-disable-next-line no-unused-vars#deprecatedWidgetOverride(widgetName, override) {// insert here the code to handle widget deprecations, e.g. for the header widgets we used:// if (DEPRECATED_HEADER_WIDGETS.includes(widgetName)) {@@ -3436,11 +3435,12 @@ function getPluginApi(version) {}/**- * withPluginApi(version, apiCodeCallback, opts)+ * Executes the provided callback function with the `PluginApi` object if the specified API version is available.*- * Helper to version our client side plugin API. Pass the version of the API that your- * plugin is coded against. If that API is available, the `apiCodeCallback` function will- * be called with the `PluginApi` object.+ * @param {number} version - The version of the API that the plugin is coded against.+ * @param {(api: PluginApi, opts: object) => void} apiCodeCallback - The callback function to execute if the API version is available+ * @param {object} [opts] - Optional additional options to pass to the callback function.+ * @returns {*} The result of the `callback` function, if executed*/export function withPluginApi(version, apiCodeCallback, opts) {opts = opts || {};