mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Make api version optional (#31160)
We'll be making this change more deeply soon. For now, this is the minimum change required to a this version-free syntax work under Discourse 3.4.0.
This commit is contained in:
parent
50337a7595
commit
acad83199e
@ -3466,7 +3466,14 @@ function getPluginApi(version) {
|
||||
* @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) {
|
||||
export function withPluginApi(...args) {
|
||||
let version, apiCodeCallback, opts;
|
||||
if (typeof args[0] === "function") {
|
||||
[version, apiCodeCallback, opts] = ["0", ...args];
|
||||
} else {
|
||||
[version, apiCodeCallback, opts] = args;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
const api = getPluginApi(version);
|
||||
|
Loading…
Reference in New Issue
Block a user