@webview-bridge/web 1.0.2 → 1.0.4
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/typescript/packages/web/src/linkNativeMethod.d.ts +5 -5
- package/dist/typescript/packages/web/src/registerWebMethod.d.ts +1 -1
- package/dist/typescript/packages/web/src/types/index.d.ts +2 -5
- package/package.json +9 -4
- package/dist/typescript/packages/web/src/createNativeMethod.d.ts +0 -3
- package/dist/typescript/packages/web/src/createWebMethod.d.ts +0 -2
- package/dist/typescript/shared/util/src/types.d.ts +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WithAvailable } from "./types";
|
|
2
|
-
export interface LinkNativeMethodOptions<
|
|
1
|
+
import { Bridge, WithAvailable } from "./types";
|
|
2
|
+
export interface LinkNativeMethodOptions<BridgeObject extends Bridge> {
|
|
3
3
|
timeout?: number;
|
|
4
|
-
throwOnError?: boolean | (keyof
|
|
5
|
-
onFallback?: (method: keyof
|
|
4
|
+
throwOnError?: boolean | (keyof BridgeObject)[];
|
|
5
|
+
onFallback?: (method: keyof BridgeObject) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const linkNativeMethod: <
|
|
7
|
+
export declare const linkNativeMethod: <BridgeObject extends Bridge>(options?: LinkNativeMethodOptions<BridgeObject>) => WithAvailable<BridgeObject>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Bridge } from "./types";
|
|
2
|
-
export declare const registerWebMethod: Bridge;
|
|
2
|
+
export declare const registerWebMethod: <BridgeObject extends Bridge>(bridge: BridgeObject) => BridgeObject;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
3
|
-
[K in keyof T]: (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>>;
|
|
4
|
-
};
|
|
5
|
-
export type Bridge = <T extends Record<string, Procedure>>(procedures: T) => ProceduresObject<T>;
|
|
1
|
+
export type AsyncFunction = (...args: any[]) => Promise<any>;
|
|
2
|
+
export type Bridge = Record<string, AsyncFunction>;
|
|
6
3
|
export type WithAvailable<T> = {
|
|
7
4
|
isWebViewBridgeAvailable: boolean;
|
|
8
5
|
} & T;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webview-bridge/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"description": "Integration Web and React Native WebView",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -20,9 +20,14 @@
|
|
|
20
20
|
"types": "/dist/typescript/packages/web/src/index.d.ts",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"require": {
|
|
24
|
+
"default": "./dist/commonjs/index.cjs",
|
|
25
|
+
"types": "./dist/typescript/packages/web/src/index.d.cts"
|
|
26
|
+
},
|
|
27
|
+
"import": {
|
|
28
|
+
"default": "./dist/module/index.mjs",
|
|
29
|
+
"types": "./dist/typescript/packages/web/src/index.d.ts"
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"devDependencies": {
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type Procedure = (...args: any[]) => any;
|
|
2
|
-
export type ProceduresObject<T extends Record<string, Procedure>> = {
|
|
3
|
-
[K in keyof T]: (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>>;
|
|
4
|
-
};
|
|
5
|
-
export type Bridge = <T extends Record<string, Procedure>>(procedures: T) => ProceduresObject<T>;
|