Skip to content

Commit

Permalink
export type
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Aug 31, 2024
1 parent 7e013bf commit d92aae7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint:fix": "eslint page --fix",
"check": "tsc --noEmit",
"build": "node scripts/build.mjs",
"prepack": "rm -rf dist && cp -rL preview dist"
"prepack": "rm -rf dist && cp -rL preview dist && cp page/Fcitx5.d.ts dist"
},
"license": "AGPL-3.0-or-later",
"devDependencies": {
Expand Down
12 changes: 12 additions & 0 deletions page/Fcitx5.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export interface FCITX {
enable: () => void
disable: () => void
currentInputMethod: () => string
setCurrentInputMethod: (im: string) => void
getInputMethods: () => { name: string, displayName: string }[]
setInputMethods: (ims: string[]) => void
setStatusAreaCallback: (callback: () => void) => void
updateStatusArea: () => void
}

export const fcitxReady: Promise<null>
4 changes: 3 additions & 1 deletion page/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { FCITX } from './Fcitx5.d.ts'

declare global {
type WASM_TYPE = 'void' | 'bool' | 'number' | 'string'
interface EM_MODULE {
ccall: (name: string, retType: WASM_TYPE, argsType: WASM_TYPE[], args: any[]) => any
onRuntimeInitialized: () => void
}
interface Window {
fcitx: { [key: string]: (...args: any[]) => void }
fcitx: { [key: string]: (...args: any[]) => void } & FCITX
}
}

Expand Down

0 comments on commit d92aae7

Please sign in to comment.