@wox-launcher/wox-plugin 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +10 -0
- package/dist/context.js +24 -0
- package/dist/index.d.ts +11 -10
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Context {
|
|
2
|
+
Values: {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
Get: (key: string) => string;
|
|
6
|
+
Set: (key: string, value: string) => void;
|
|
7
|
+
Exists: (key: string) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function NewContext(): Context;
|
|
10
|
+
export declare function NewContextWithValue(key: string, value: string): Context;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewContextWithValue = exports.NewContext = void 0;
|
|
4
|
+
function NewContext() {
|
|
5
|
+
return {
|
|
6
|
+
Values: {},
|
|
7
|
+
Get: function (key) {
|
|
8
|
+
return this.Values[key];
|
|
9
|
+
},
|
|
10
|
+
Set: function (key, value) {
|
|
11
|
+
this.Values[key] = value;
|
|
12
|
+
},
|
|
13
|
+
Exists: function (key) {
|
|
14
|
+
return this.Values[key] !== undefined;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.NewContext = NewContext;
|
|
19
|
+
function NewContextWithValue(key, value) {
|
|
20
|
+
var ctx = NewContext();
|
|
21
|
+
ctx.Set(key, value);
|
|
22
|
+
return ctx;
|
|
23
|
+
}
|
|
24
|
+
exports.NewContextWithValue = NewContextWithValue;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Context } from "./context";
|
|
1
2
|
export interface Plugin {
|
|
2
3
|
init: (context: PluginInitContext) => Promise<void>;
|
|
3
4
|
query: (query: Query) => Promise<Result[]>;
|
|
@@ -99,45 +100,45 @@ export interface PublicAPI {
|
|
|
99
100
|
/**
|
|
100
101
|
* Change Wox query
|
|
101
102
|
*/
|
|
102
|
-
ChangeQuery: (query: ChangeQueryParam) => Promise<void>;
|
|
103
|
+
ChangeQuery: (ctx: Context, query: ChangeQueryParam) => Promise<void>;
|
|
103
104
|
/**
|
|
104
105
|
* Hide Wox
|
|
105
106
|
*/
|
|
106
|
-
HideApp: () => Promise<void>;
|
|
107
|
+
HideApp: (ctx: Context) => Promise<void>;
|
|
107
108
|
/**
|
|
108
109
|
* Show Wox
|
|
109
110
|
*/
|
|
110
|
-
ShowApp: () => Promise<void>;
|
|
111
|
+
ShowApp: (ctx: Context) => Promise<void>;
|
|
111
112
|
/**
|
|
112
113
|
* Notify message
|
|
113
114
|
*/
|
|
114
|
-
Notify: (title: string, description?: string) => Promise<void>;
|
|
115
|
+
Notify: (ctx: Context, title: string, description?: string) => Promise<void>;
|
|
115
116
|
/**
|
|
116
117
|
* Write log
|
|
117
118
|
*/
|
|
118
|
-
Log: (level: "Info" | "Error" | "Debug" | "Warning", msg: string) => Promise<void>;
|
|
119
|
+
Log: (ctx: Context, level: "Info" | "Error" | "Debug" | "Warning", msg: string) => Promise<void>;
|
|
119
120
|
/**
|
|
120
121
|
* Get translation of current language
|
|
121
122
|
*/
|
|
122
|
-
GetTranslation: (key: string) => Promise<string>;
|
|
123
|
+
GetTranslation: (ctx: Context, key: string) => Promise<string>;
|
|
123
124
|
/**
|
|
124
125
|
* Get customized setting
|
|
125
126
|
*
|
|
126
127
|
* will try to get platform specific setting first, if not found, will try to get global setting
|
|
127
128
|
*/
|
|
128
|
-
GetSetting: (key: string) => Promise<string>;
|
|
129
|
+
GetSetting: (ctx: Context, key: string) => Promise<string>;
|
|
129
130
|
/**
|
|
130
131
|
* Save customized setting
|
|
131
132
|
*
|
|
132
133
|
* @isPlatformSpecific If true, setting will be only saved in current platform. If false, setting will be available in all platforms
|
|
133
134
|
*/
|
|
134
|
-
SaveSetting: (key: string, value: string, isPlatformSpecific: boolean) => Promise<void>;
|
|
135
|
+
SaveSetting: (ctx: Context, key: string, value: string, isPlatformSpecific: boolean) => Promise<void>;
|
|
135
136
|
/**
|
|
136
137
|
* Register setting changed callback
|
|
137
138
|
*/
|
|
138
|
-
OnSettingChanged: (callback: (key: string, value: string) => void) => Promise<void>;
|
|
139
|
+
OnSettingChanged: (ctx: Context, callback: (key: string, value: string) => void) => Promise<void>;
|
|
139
140
|
}
|
|
140
|
-
export type WoxImageType = "absolute" | "relative" | "base64" | "svg" | "url";
|
|
141
|
+
export type WoxImageType = "absolute" | "relative" | "base64" | "svg" | "url" | "emoji";
|
|
141
142
|
export interface WoxImage {
|
|
142
143
|
ImageType: WoxImageType;
|
|
143
144
|
ImageData: string;
|