enhance(plugin): app proxy call

This commit is contained in:
charlie
2025-01-06 17:34:03 +08:00
parent 87e01f116b
commit 25adb80b96
3 changed files with 12 additions and 5 deletions

View File

@@ -145,6 +145,7 @@ export interface AppUserInfo {
export interface AppInfo {
version: string
supportDb: boolean
[key: string]: unknown
}

View File

@@ -734,7 +734,8 @@ export class LSPluginUser
return function (this: any, ...args: any) {
if (origMethod) {
const ret = origMethod.apply(that, args.concat(tag))
if (args?.length !== 0) args.concat(tag)
const ret = origMethod.apply(that, args)
if (ret !== PROXY_CONTINUE) return ret
}
@@ -817,11 +818,15 @@ export class LSPluginUser
return this._execCallableAPIAsync(`_callMainWin`, ...args)
}
// User Proxies
#appProxy: IAppProxy
/**
* The interface methods of {@link IAppProxy}
*/
get App (): IAppProxy {
return this._makeUserProxy(app, 'app')
if (this.#appProxy) return this.#appProxy
return (this.#appProxy = this._makeUserProxy(app, 'app'))
}
get Editor (): IEditorProxy {

View File

@@ -128,9 +128,10 @@
(defn ^:export get_app_info
;; get app base info
[]
(bean/->js
(sdk-utils/normalize-keyword-for-json
{:version fv/version})))
(-> (sdk-utils/normalize-keyword-for-json
{:version fv/version
:supportDb true})
(bean/->js)))
(def ^:export get_user_configs
(fn []