1
- import type { Plugin , PluginInitContext , Query , Result } from "@wox-launcher/wox-plugin"
1
+ import { Context , Plugin , PluginInitParams , PublicAPI , Query , Result } from "@wox-launcher/wox-plugin"
2
2
import emoji from "emojilib"
3
3
import clipboard from "clipboardy"
4
4
5
+ let api : PublicAPI
6
+
5
7
export const plugin : Plugin = {
6
- init : async ( context : PluginInitContext ) => { } ,
8
+ init : async ( ctx : Context , initParams : PluginInitParams ) => {
9
+ api = initParams . API
10
+ await api . Log ( ctx , "Debug" , `init, directory:${ initParams . PluginDirectory } ` )
11
+ } ,
7
12
8
- query : async ( query : Query ) : Promise < Result [ ] > => {
13
+ query : async ( ctx : Context , query : Query ) : Promise < Result [ ] > => {
9
14
let search = query . Search
10
15
if ( query . Search === "" ) {
16
+ await api . Log ( ctx , "Debug" , "empty search, use default search" )
11
17
search = "smile"
12
18
}
13
19
14
20
return Object . keys ( emoji )
15
21
. filter ( key => {
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
23
// @ts -ignore
17
24
const emojiData = emoji [ key ] as string [ ]
18
25
return emojiData . some ( ( keyword : string ) => {
@@ -21,6 +28,7 @@ export const plugin: Plugin = {
21
28
} )
22
29
. map ( key => {
23
30
return {
31
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
32
// @ts -ignore
25
33
Title : ( emoji [ key ] [ 0 ] as string ) . replace ( / _ / g, " " ) ,
26
34
Icon : {
0 commit comments