improve(plugin): update types

This commit is contained in:
charlie
2022-08-01 11:35:39 +08:00
committed by Andelf
parent 1665058386
commit 7bd32fb911
3 changed files with 10 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import {
safetyPathJoin,
} from './helpers'
import { LSPluginCaller } from './LSPlugin.caller'
import * as callableAPIs from './callable.apis'
import {
IAppProxy,
IDBProxy,
@@ -48,6 +49,9 @@ declare global {
}
}
type callableMethods =
keyof typeof callableAPIs | string // host exported SDK apis & host platform related apis
const PROXY_CONTINUE = Symbol.for('proxy-continue')
const debug = Debug('LSPlugin:user')
@@ -623,14 +627,14 @@ export class LSPluginUser
})
}
_execCallableAPIAsync(method, ...args) {
_execCallableAPIAsync(method: callableMethods, ...args) {
return this._caller.callAsync(`api:call`, {
method,
args,
})
}
_execCallableAPI(method, ...args) {
_execCallableAPI(method: callableMethods, ...args) {
this._caller.call(`api:call`, {
method,
args,

View File

@@ -1,5 +1,8 @@
import { PluginLocal } from './LSPlugin.core'
/**
* Run in host
*/
export function setSDKMetadata(this: PluginLocal, data: any) {
if (this?.sdk && data) {
this.sdk = Object.assign({}, this.sdk, data)

View File

@@ -91,7 +91,7 @@
[:div.flex.flex-row.items-center.mr-2.ml-1 {:style {:height 24}}
[:span.bullet-container.cursor
[:span.bullet]]]
[:div.flex.flex-1 {:tabindex 0
[:div.flex.flex-1 {:tabIndex 0
:on-key-press (fn [e]
(when (= "Enter" (util/ekey e))
(handler-fn)))