@etsoo/appscript 1.2.51 → 1.2.52
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/lib/cjs/bridges/BridgeUtils.d.ts +2 -1
- package/lib/cjs/bridges/FlutterHost.d.ts +3 -2
- package/lib/cjs/bridges/FlutterHost.js +12 -0
- package/lib/cjs/bridges/IBridgeHost.d.ts +7 -0
- package/lib/mjs/bridges/BridgeUtils.d.ts +2 -1
- package/lib/mjs/bridges/FlutterHost.d.ts +3 -2
- package/lib/mjs/bridges/FlutterHost.js +12 -0
- package/lib/mjs/bridges/IBridgeHost.d.ts +7 -0
- package/package.json +1 -1
- package/src/bridges/FlutterHost.ts +13 -1
- package/src/bridges/IBridgeHost.ts +8 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlutterHost } from './FlutterHost';
|
|
1
2
|
import { IBridgeHost } from './IBridgeHost';
|
|
2
3
|
/**
|
|
3
4
|
* Bridge utils
|
|
@@ -6,5 +7,5 @@ export declare namespace BridgeUtils {
|
|
|
6
7
|
/**
|
|
7
8
|
* Bridge host
|
|
8
9
|
*/
|
|
9
|
-
const host: IBridgeHost | undefined;
|
|
10
|
+
const host: IBridgeHost | FlutterHost | undefined;
|
|
10
11
|
}
|
|
@@ -4,7 +4,7 @@ import { IBridgeHost } from './IBridgeHost';
|
|
|
4
4
|
* https://inappwebview.dev/docs/javascript/communication/
|
|
5
5
|
*/
|
|
6
6
|
export declare class FlutterHost implements IBridgeHost {
|
|
7
|
-
callHandler: (name: string, ...args: unknown[]) => PromiseLike<
|
|
7
|
+
callHandler: (name: string, ...args: unknown[]) => PromiseLike<Record<string, unknown> | void>;
|
|
8
8
|
/**
|
|
9
9
|
* Start Url
|
|
10
10
|
*/
|
|
@@ -13,9 +13,10 @@ export declare class FlutterHost implements IBridgeHost {
|
|
|
13
13
|
* Constructor
|
|
14
14
|
* @param callHandler Call handler
|
|
15
15
|
*/
|
|
16
|
-
constructor(callHandler: (name: string, ...args: unknown[]) => PromiseLike<
|
|
16
|
+
constructor(callHandler: (name: string, ...args: unknown[]) => PromiseLike<Record<string, unknown> | void>);
|
|
17
17
|
changeCulture(locale: string): void;
|
|
18
18
|
exit(): void;
|
|
19
|
+
getLabels<T extends string>(...keys: T[]): Promise<any>;
|
|
19
20
|
getStartUrl(): string | null | undefined;
|
|
20
21
|
loadApp(name: string, startUrl?: string): void;
|
|
21
22
|
}
|
|
@@ -19,6 +19,18 @@ class FlutterHost {
|
|
|
19
19
|
exit() {
|
|
20
20
|
this.callHandler('exit');
|
|
21
21
|
}
|
|
22
|
+
async getLabels(...keys) {
|
|
23
|
+
var _a;
|
|
24
|
+
const init = {};
|
|
25
|
+
const result = (_a = (await this.callHandler('getLabels'))) !== null && _a !== void 0 ? _a : {};
|
|
26
|
+
return keys.reduce((a, v) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return ({
|
|
29
|
+
...a,
|
|
30
|
+
[v]: (_a = result[v]) !== null && _a !== void 0 ? _a : ''
|
|
31
|
+
});
|
|
32
|
+
}, init);
|
|
33
|
+
}
|
|
22
34
|
getStartUrl() {
|
|
23
35
|
return this.startUrl;
|
|
24
36
|
}
|
|
@@ -11,6 +11,13 @@ export interface IBridgeHost {
|
|
|
11
11
|
* Exit the application
|
|
12
12
|
*/
|
|
13
13
|
exit(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get multiple culture labels
|
|
16
|
+
* @param keys Keys
|
|
17
|
+
*/
|
|
18
|
+
getLabels<T extends string>(...keys: T[]): PromiseLike<{
|
|
19
|
+
[K in T]: string;
|
|
20
|
+
}>;
|
|
14
21
|
/**
|
|
15
22
|
* Get app start Url / router Url
|
|
16
23
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlutterHost } from './FlutterHost';
|
|
1
2
|
import { IBridgeHost } from './IBridgeHost';
|
|
2
3
|
/**
|
|
3
4
|
* Bridge utils
|
|
@@ -6,5 +7,5 @@ export declare namespace BridgeUtils {
|
|
|
6
7
|
/**
|
|
7
8
|
* Bridge host
|
|
8
9
|
*/
|
|
9
|
-
const host: IBridgeHost | undefined;
|
|
10
|
+
const host: IBridgeHost | FlutterHost | undefined;
|
|
10
11
|
}
|
|
@@ -4,7 +4,7 @@ import { IBridgeHost } from './IBridgeHost';
|
|
|
4
4
|
* https://inappwebview.dev/docs/javascript/communication/
|
|
5
5
|
*/
|
|
6
6
|
export declare class FlutterHost implements IBridgeHost {
|
|
7
|
-
callHandler: (name: string, ...args: unknown[]) => PromiseLike<
|
|
7
|
+
callHandler: (name: string, ...args: unknown[]) => PromiseLike<Record<string, unknown> | void>;
|
|
8
8
|
/**
|
|
9
9
|
* Start Url
|
|
10
10
|
*/
|
|
@@ -13,9 +13,10 @@ export declare class FlutterHost implements IBridgeHost {
|
|
|
13
13
|
* Constructor
|
|
14
14
|
* @param callHandler Call handler
|
|
15
15
|
*/
|
|
16
|
-
constructor(callHandler: (name: string, ...args: unknown[]) => PromiseLike<
|
|
16
|
+
constructor(callHandler: (name: string, ...args: unknown[]) => PromiseLike<Record<string, unknown> | void>);
|
|
17
17
|
changeCulture(locale: string): void;
|
|
18
18
|
exit(): void;
|
|
19
|
+
getLabels<T extends string>(...keys: T[]): Promise<any>;
|
|
19
20
|
getStartUrl(): string | null | undefined;
|
|
20
21
|
loadApp(name: string, startUrl?: string): void;
|
|
21
22
|
}
|
|
@@ -16,6 +16,18 @@ export class FlutterHost {
|
|
|
16
16
|
exit() {
|
|
17
17
|
this.callHandler('exit');
|
|
18
18
|
}
|
|
19
|
+
async getLabels(...keys) {
|
|
20
|
+
var _a;
|
|
21
|
+
const init = {};
|
|
22
|
+
const result = (_a = (await this.callHandler('getLabels'))) !== null && _a !== void 0 ? _a : {};
|
|
23
|
+
return keys.reduce((a, v) => {
|
|
24
|
+
var _a;
|
|
25
|
+
return ({
|
|
26
|
+
...a,
|
|
27
|
+
[v]: (_a = result[v]) !== null && _a !== void 0 ? _a : ''
|
|
28
|
+
});
|
|
29
|
+
}, init);
|
|
30
|
+
}
|
|
19
31
|
getStartUrl() {
|
|
20
32
|
return this.startUrl;
|
|
21
33
|
}
|
|
@@ -11,6 +11,13 @@ export interface IBridgeHost {
|
|
|
11
11
|
* Exit the application
|
|
12
12
|
*/
|
|
13
13
|
exit(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get multiple culture labels
|
|
16
|
+
* @param keys Keys
|
|
17
|
+
*/
|
|
18
|
+
getLabels<T extends string>(...keys: T[]): PromiseLike<{
|
|
19
|
+
[K in T]: string;
|
|
20
|
+
}>;
|
|
14
21
|
/**
|
|
15
22
|
* Get app start Url / router Url
|
|
16
23
|
*/
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export class FlutterHost implements IBridgeHost {
|
|
|
18
18
|
public callHandler: (
|
|
19
19
|
name: string,
|
|
20
20
|
...args: unknown[]
|
|
21
|
-
) => PromiseLike<
|
|
21
|
+
) => PromiseLike<Record<string, unknown> | void>
|
|
22
22
|
) {}
|
|
23
23
|
|
|
24
24
|
changeCulture(locale: string): void {
|
|
@@ -29,6 +29,18 @@ export class FlutterHost implements IBridgeHost {
|
|
|
29
29
|
this.callHandler('exit');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
async getLabels<T extends string>(...keys: T[]) {
|
|
33
|
+
const init: any = {};
|
|
34
|
+
const result = (await this.callHandler('getLabels')) ?? {};
|
|
35
|
+
return keys.reduce(
|
|
36
|
+
(a, v) => ({
|
|
37
|
+
...a,
|
|
38
|
+
[v]: result[v] ?? ''
|
|
39
|
+
}),
|
|
40
|
+
init
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
getStartUrl(): string | null | undefined {
|
|
33
45
|
return this.startUrl;
|
|
34
46
|
}
|
|
@@ -13,6 +13,14 @@ export interface IBridgeHost {
|
|
|
13
13
|
*/
|
|
14
14
|
exit(): void;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Get multiple culture labels
|
|
18
|
+
* @param keys Keys
|
|
19
|
+
*/
|
|
20
|
+
getLabels<T extends string>(
|
|
21
|
+
...keys: T[]
|
|
22
|
+
): PromiseLike<{ [K in T]: string }>;
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
* Get app start Url / router Url
|
|
18
26
|
*/
|