@webview-bridge/react-native 1.0.3 → 1.0.5

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.
Files changed (30) hide show
  1. package/LICENSE +21 -0
  2. package/dist/packages/react-native/src/createWebView.d.ts +8 -7
  3. package/dist/packages/react-native/src/createWebView.js +2 -2
  4. package/dist/packages/react-native/src/index.d.ts +2 -1
  5. package/dist/packages/react-native/src/index.js +2 -1
  6. package/dist/packages/react-native/src/integrations/bridge.d.ts +3 -3
  7. package/dist/packages/react-native/src/integrations/handleRegisterWebMethod.d.ts +2 -2
  8. package/dist/packages/react-native/src/types/bridge.d.ts +2 -0
  9. package/dist/packages/react-native/src/types/webview.d.ts +3 -0
  10. package/package.json +2 -2
  11. package/dist/packages/native/src/createWebView.d.ts +0 -17
  12. package/dist/packages/native/src/createWebView.js +0 -87
  13. package/dist/packages/native/src/index.d.ts +0 -3
  14. package/dist/packages/native/src/index.js +0 -19
  15. package/dist/packages/native/src/integrations/bridge.d.ts +0 -13
  16. package/dist/packages/native/src/integrations/bridge.js +0 -20
  17. package/dist/packages/native/src/integrations/console.d.ts +0 -3
  18. package/dist/packages/native/src/integrations/console.js +0 -51
  19. package/dist/packages/native/src/integrations/createWebMethod.d.ts +0 -4
  20. package/dist/packages/native/src/integrations/createWebMethod.js +0 -23
  21. package/dist/packages/native/src/integrations/handleRegisterWebMethod.d.ts +0 -4
  22. package/dist/packages/native/src/integrations/handleRegisterWebMethod.js +0 -23
  23. package/dist/packages/native/src/integrations/index.d.ts +0 -2
  24. package/dist/packages/native/src/integrations/index.js +0 -18
  25. package/dist/packages/native/src/types/index.d.ts +0 -8
  26. package/dist/packages/react-native/src/types/index.d.ts +0 -8
  27. package/dist/shared/util/src/types.d.ts +0 -5
  28. package/dist/shared/util/src/types.js +0 -2
  29. /package/dist/packages/{native/src/types/index.js → react-native/src/types/bridge.js} +0 -0
  30. /package/dist/packages/react-native/src/types/{index.js → webview.js} +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Sungyu Kang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,17 +1,18 @@
1
1
  import React from "react";
2
- import type { BridgeWebView, Procedure, ProceduresObject } from "./types";
3
- export type CreateWebViewArgs<T extends ProceduresObject<Record<string, Procedure>>> = {
4
- bridge: T;
2
+ import { Bridge } from "./types/bridge";
3
+ import type { BridgeWebView } from "./types/webview";
4
+ export type CreateWebViewArgs<BridgeObject extends Bridge> = {
5
+ bridge: BridgeObject;
5
6
  debug?: boolean;
6
7
  responseTimeout?: number;
7
- fallback?: (method: keyof T) => void;
8
+ fallback?: (method: keyof BridgeObject) => void;
8
9
  };
9
10
  export type WebMethod<T> = T & {
10
11
  isReady: boolean;
11
12
  };
12
- export declare const createWebView: <T extends ProceduresObject<Record<string, Procedure>>>({ bridge, debug, responseTimeout, fallback, }: CreateWebViewArgs<T>) => {
13
+ export declare const createWebView: <BridgeObject extends Bridge>({ bridge, debug, responseTimeout, fallback, }: CreateWebViewArgs<BridgeObject>) => {
13
14
  WebView: React.ForwardRefExoticComponent<import("react-native-webview/lib/WebViewTypes").IOSWebViewProps & import("react-native-webview/lib/WebViewTypes").AndroidWebViewProps & import("react-native-webview/lib/WebViewTypes").WindowsWebViewProps & React.RefAttributes<BridgeWebView>>;
14
- linkWebMethod<T_1>(): {
15
- current: WebMethod<T_1>;
15
+ linkWebMethod<T>(): {
16
+ current: WebMethod<T>;
16
17
  };
17
18
  };
@@ -65,7 +65,7 @@ const createWebView = ({ bridge, debug, responseTimeout = 2000, fallback, }) =>
65
65
  }
66
66
  }
67
67
  };
68
- return (<react_native_webview_1.default ref={webviewRef} onMessage={handleMessage} injectedJavaScriptBeforeContentLoaded={[
68
+ return (<react_native_webview_1.default {...props} ref={webviewRef} onMessage={handleMessage} injectedJavaScriptBeforeContentLoaded={[
69
69
  (0, integrations_1.INTEGRATIONS_SCRIPTS_BRIDGE)(bridgeNames),
70
70
  props.injectedJavaScriptBeforeContentLoaded,
71
71
  "true;",
@@ -77,7 +77,7 @@ const createWebView = ({ bridge, debug, responseTimeout = 2000, fallback, }) =>
77
77
  "true;",
78
78
  ]
79
79
  .filter(Boolean)
80
- .join("\n")} {...props}/>);
80
+ .join("\n")}/>);
81
81
  }),
82
82
  linkWebMethod() {
83
83
  return WebMethod;
@@ -1,3 +1,4 @@
1
1
  export * from "./createWebView";
2
2
  export * from "./integrations/bridge";
3
- export * from "./types";
3
+ export * from "./types/bridge";
4
+ export * from "./types/webview";
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./createWebView"), exports);
18
18
  __exportStar(require("./integrations/bridge"), exports);
19
- __exportStar(require("./types"), exports);
19
+ __exportStar(require("./types/bridge"), exports);
20
+ __exportStar(require("./types/webview"), exports);
@@ -1,8 +1,8 @@
1
1
  import WebView from "react-native-webview";
2
- import type { Bridge, Procedure, ProceduresObject } from "../types";
3
- export declare const bridge: Bridge;
2
+ import type { Bridge } from "../types/bridge";
3
+ export declare const bridge: <BridgeObject extends Bridge>(procedures: BridgeObject) => BridgeObject;
4
4
  type HandleBridgeArgs<ArgType = unknown> = {
5
- bridge: ProceduresObject<Record<string, Procedure>>;
5
+ bridge: Bridge;
6
6
  method: string;
7
7
  args?: ArgType[];
8
8
  webview: WebView;
@@ -1,4 +1,4 @@
1
1
  import { type EventEmitter } from "../../../../shared/util/src";
2
2
  import WebView from "react-native-webview";
3
- import { Procedure } from "../types";
4
- export declare const handleRegisterWebMethod: (emitter: EventEmitter, webview: WebView, bridgeNames: string[], responseTimeout: number) => Record<string, Procedure>;
3
+ import { Bridge } from "../types/bridge";
4
+ export declare const handleRegisterWebMethod: (emitter: EventEmitter, webview: WebView, bridgeNames: string[], responseTimeout: number) => Bridge;
@@ -0,0 +1,2 @@
1
+ export type AsyncFunction = (...args: any[]) => Promise<any>;
2
+ export type Bridge = Record<string, AsyncFunction>;
@@ -0,0 +1,3 @@
1
+ import { Component } from "react";
2
+ import WebView, { WebViewProps } from "react-native-webview";
3
+ export type BridgeWebView = Pick<WebView, Exclude<keyof WebView, keyof Component<WebViewProps>>>;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@webview-bridge/react-native",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
- "description": "Integration Web and React Native WebView",
5
+ "description": "Fully Type-Safe Integration for React Native WebView and Web",
6
6
  "main": "dist/packages/react-native/src/index.js",
7
7
  "types": "dist/packages/react-native/src/index.d.ts",
8
8
  "publishConfig": {
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- import type { BridgeWebView, Procedure, ProceduresObject } from "./types";
3
- export type CreateWebViewArgs<T extends ProceduresObject<Record<string, Procedure>>> = {
4
- bridge: T;
5
- debug?: boolean;
6
- responseTimeout?: number;
7
- fallback?: (method: keyof T) => void;
8
- };
9
- export type WebMethod<T> = T & {
10
- isReady: boolean;
11
- };
12
- export declare const createWebView: <T extends ProceduresObject<Record<string, Procedure>>>({ bridge, debug, responseTimeout, fallback, }: CreateWebViewArgs<T>) => {
13
- WebView: React.ForwardRefExoticComponent<import("react-native-webview/lib/WebViewTypes").IOSWebViewProps & import("react-native-webview/lib/WebViewTypes").AndroidWebViewProps & import("react-native-webview/lib/WebViewTypes").WindowsWebViewProps & React.RefAttributes<BridgeWebView>>;
14
- linkWebMethod<T_1>(): {
15
- current: WebMethod<T_1>;
16
- };
17
- };
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createWebView = void 0;
7
- const util_1 = require("../../../shared/util/src");
8
- const react_1 = require("react");
9
- const react_2 = __importDefault(require("react"));
10
- const react_native_webview_1 = __importDefault(require("react-native-webview"));
11
- const integrations_1 = require("./integrations");
12
- const handleRegisterWebMethod_1 = require("./integrations/handleRegisterWebMethod");
13
- const createWebView = ({ bridge, debug, responseTimeout = 2000, fallback, }) => {
14
- const WebMethod = {
15
- current: {
16
- isReady: false,
17
- },
18
- };
19
- const emitter = (0, util_1.createEvents)();
20
- return {
21
- WebView: (0, react_1.forwardRef)((props, ref) => {
22
- const webviewRef = (0, react_1.useRef)(null);
23
- const bridgeNames = (0, react_1.useMemo)(() => Object.values(bridge ?? {}).map((func) => {
24
- return `'${func.name}'`;
25
- }), []);
26
- (0, react_1.useImperativeHandle)(ref, () => webviewRef.current, []);
27
- const handleMessage = async (event) => {
28
- props.onMessage?.(event);
29
- if (!webviewRef.current) {
30
- return;
31
- }
32
- const { type, body } = JSON.parse(event.nativeEvent.data);
33
- switch (type) {
34
- case "log": {
35
- const { method, args } = body;
36
- debug && (0, integrations_1.handleLog)(method, args);
37
- return;
38
- }
39
- case "bridge": {
40
- const { method, args, eventId } = body;
41
- (0, integrations_1.handleBridge)({
42
- bridge,
43
- method,
44
- args,
45
- eventId,
46
- webview: webviewRef.current,
47
- });
48
- return;
49
- }
50
- case "registerWebMethod": {
51
- const { bridgeNames } = body;
52
- Object.assign(WebMethod.current, (0, handleRegisterWebMethod_1.handleRegisterWebMethod)(emitter, webviewRef.current, bridgeNames, responseTimeout));
53
- WebMethod.current.isReady = true;
54
- return;
55
- }
56
- case "webMethodResponse": {
57
- const { eventId, funcName, value } = body;
58
- emitter.emit(`${funcName}-${eventId}`, value);
59
- return;
60
- }
61
- case "fallback": {
62
- const { method } = body;
63
- fallback?.(method);
64
- return;
65
- }
66
- }
67
- };
68
- return (<react_native_webview_1.default ref={webviewRef} onMessage={handleMessage} injectedJavaScriptBeforeContentLoaded={[
69
- (0, integrations_1.INTEGRATIONS_SCRIPTS_BRIDGE)(bridgeNames),
70
- props.injectedJavaScriptBeforeContentLoaded,
71
- "true;",
72
- ]
73
- .filter(Boolean)
74
- .join("\n")} injectedJavaScript={[
75
- console && integrations_1.INTEGRATIONS_SCRIPTS_CONSOLE,
76
- props.injectedJavaScript,
77
- "true;",
78
- ]
79
- .filter(Boolean)
80
- .join("\n")} {...props}/>);
81
- }),
82
- linkWebMethod() {
83
- return WebMethod;
84
- },
85
- };
86
- };
87
- exports.createWebView = createWebView;
@@ -1,3 +0,0 @@
1
- export * from "./createWebView";
2
- export * from "./integrations/bridge";
3
- export * from "./types";
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./createWebView"), exports);
18
- __exportStar(require("./integrations/bridge"), exports);
19
- __exportStar(require("./types"), exports);
@@ -1,13 +0,0 @@
1
- import WebView from "react-native-webview";
2
- import type { Bridge, Procedure, ProceduresObject } from "../types";
3
- export declare const bridge: Bridge;
4
- type HandleBridgeArgs<ArgType = unknown> = {
5
- bridge: ProceduresObject<Record<string, Procedure>>;
6
- method: string;
7
- args?: ArgType[];
8
- webview: WebView;
9
- eventId: string;
10
- };
11
- export declare const handleBridge: ({ bridge, method, args, webview, eventId, }: HandleBridgeArgs) => Promise<void>;
12
- export declare const INTEGRATIONS_SCRIPTS_BRIDGE: (bridgeNames: string[]) => string;
13
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INTEGRATIONS_SCRIPTS_BRIDGE = exports.handleBridge = exports.bridge = void 0;
4
- const bridge = (procedures) => {
5
- return procedures;
6
- };
7
- exports.bridge = bridge;
8
- const handleBridge = async ({ bridge, method, args, webview, eventId, }) => {
9
- const response = await bridge[method]?.(...(args ?? []));
10
- webview.injectJavaScript(`
11
- window.nativeEmitter.emit('${method}-${eventId}',${JSON.stringify(response)});
12
-
13
- true;
14
- `);
15
- };
16
- exports.handleBridge = handleBridge;
17
- const INTEGRATIONS_SCRIPTS_BRIDGE = (bridgeNames) => `
18
- window.__bridgeMethods__ = [${bridgeNames.join(", ")}];
19
- `;
20
- exports.INTEGRATIONS_SCRIPTS_BRIDGE = INTEGRATIONS_SCRIPTS_BRIDGE;
@@ -1,3 +0,0 @@
1
- export declare const INTEGRATIONS_SCRIPTS_CONSOLE = "\n{\n const originalConsoleLog = console.log;\n const originalConsoleError = console.error;\n const originalConsoleWarn = console.warn;\n\n console.log = function() {\n var message = Array.from(arguments).join(' ');\n window.ReactNativeWebView?.postMessage(\n JSON.stringify({ type: \"log\", body: { method: \"log\", args: message } }),\n );\n originalConsoleLog.apply(console, arguments);\n };\n\n console.error = function() {\n var message = Array.from(arguments).join(' ');\n window.ReactNativeWebView?.postMessage(\n JSON.stringify({ type: \"log\", body: { method: \"error\", args: message } }),\n );\n originalConsoleError.apply(console, arguments);\n };\n\n console.warn = function() {\n var message = Array.from(arguments).join(' ');\n window.ReactNativeWebView?.postMessage(\n JSON.stringify({ type: \"log\", body: { method: \"warn\", args: message } }),\n );\n originalConsoleWarn.apply(console, arguments);\n };\n};\n";
2
- export type LogType = "log" | "error" | "warn";
3
- export declare const handleLog: (type: LogType, message?: unknown) => void;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleLog = exports.INTEGRATIONS_SCRIPTS_CONSOLE = void 0;
4
- exports.INTEGRATIONS_SCRIPTS_CONSOLE = `
5
- {
6
- const originalConsoleLog = console.log;
7
- const originalConsoleError = console.error;
8
- const originalConsoleWarn = console.warn;
9
-
10
- console.log = function() {
11
- var message = Array.from(arguments).join(' ');
12
- window.ReactNativeWebView?.postMessage(
13
- JSON.stringify({ type: "log", body: { method: "log", args: message } }),
14
- );
15
- originalConsoleLog.apply(console, arguments);
16
- };
17
-
18
- console.error = function() {
19
- var message = Array.from(arguments).join(' ');
20
- window.ReactNativeWebView?.postMessage(
21
- JSON.stringify({ type: "log", body: { method: "error", args: message } }),
22
- );
23
- originalConsoleError.apply(console, arguments);
24
- };
25
-
26
- console.warn = function() {
27
- var message = Array.from(arguments).join(' ');
28
- window.ReactNativeWebView?.postMessage(
29
- JSON.stringify({ type: "log", body: { method: "warn", args: message } }),
30
- );
31
- originalConsoleWarn.apply(console, arguments);
32
- };
33
- };
34
- `;
35
- const handleLog = (type, message) => {
36
- switch (type) {
37
- case "log": {
38
- console.log("(WebView)", message);
39
- break;
40
- }
41
- case "error": {
42
- console.error("(WebView)", message);
43
- break;
44
- }
45
- case "warn": {
46
- console.warn("(WebView)", message);
47
- break;
48
- }
49
- }
50
- };
51
- exports.handleLog = handleLog;
@@ -1,4 +0,0 @@
1
- import { type EventEmitter } from "../../../../shared/util/src";
2
- import WebView from "react-native-webview";
3
- import { Procedure } from "../types";
4
- export declare const handleCreateWebMethod: (emitter: EventEmitter, webview: WebView, bridgeNames: string[], responseTimeout: number) => Record<string, Procedure>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleCreateWebMethod = void 0;
4
- const util_1 = require("../../../../shared/util/src");
5
- const handleCreateWebMethod = (emitter, webview, bridgeNames, responseTimeout) => {
6
- return bridgeNames.reduce((acc, method) => {
7
- acc[method] = async (...args) => {
8
- const eventId = (0, util_1.createRandomId)();
9
- return Promise.race([
10
- (0, util_1.createResolver)(emitter, method, eventId, () => {
11
- webview.injectJavaScript(`
12
- window.webEmitter.emit('${method}', '${eventId}', ${JSON.stringify(args)});
13
-
14
- true;
15
- `);
16
- }),
17
- (0, util_1.timeout)(responseTimeout),
18
- ]);
19
- };
20
- return acc;
21
- }, {});
22
- };
23
- exports.handleCreateWebMethod = handleCreateWebMethod;
@@ -1,4 +0,0 @@
1
- import { type EventEmitter } from "../../../../shared/util/src";
2
- import WebView from "react-native-webview";
3
- import { Procedure } from "../types";
4
- export declare const handleRegisterWebMethod: (emitter: EventEmitter, webview: WebView, bridgeNames: string[], responseTimeout: number) => Record<string, Procedure>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleRegisterWebMethod = void 0;
4
- const util_1 = require("../../../../shared/util/src");
5
- const handleRegisterWebMethod = (emitter, webview, bridgeNames, responseTimeout) => {
6
- return bridgeNames.reduce((acc, method) => {
7
- acc[method] = async (...args) => {
8
- const eventId = (0, util_1.createRandomId)();
9
- return Promise.race([
10
- (0, util_1.createResolver)(emitter, method, eventId, () => {
11
- webview.injectJavaScript(`
12
- window.webEmitter.emit('${method}', '${eventId}', ${JSON.stringify(args)});
13
-
14
- true;
15
- `);
16
- }),
17
- (0, util_1.timeout)(responseTimeout),
18
- ]);
19
- };
20
- return acc;
21
- }, {});
22
- };
23
- exports.handleRegisterWebMethod = handleRegisterWebMethod;
@@ -1,2 +0,0 @@
1
- export * from "./bridge";
2
- export * from "./console";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./bridge"), exports);
18
- __exportStar(require("./console"), exports);
@@ -1,8 +0,0 @@
1
- import { Component } from "react";
2
- import WebView, { WebViewProps } from "react-native-webview";
3
- export type Procedure = (...args: any[]) => any;
4
- export type ProceduresObject<T extends Record<string, Procedure>> = {
5
- [K in keyof T]: (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>>;
6
- };
7
- export type Bridge = <T extends Record<string, Procedure>>(procedures: T) => ProceduresObject<T>;
8
- export type BridgeWebView = Pick<WebView, Exclude<keyof WebView, keyof Component<WebViewProps>>>;
@@ -1,8 +0,0 @@
1
- import { Component } from "react";
2
- import WebView, { WebViewProps } from "react-native-webview";
3
- export type Procedure = (...args: any[]) => any;
4
- export type ProceduresObject<T extends Record<string, Procedure>> = {
5
- [K in keyof T]: (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>>;
6
- };
7
- export type Bridge = <T extends Record<string, Procedure>>(procedures: T) => ProceduresObject<T>;
8
- export type BridgeWebView = Pick<WebView, Exclude<keyof WebView, keyof Component<WebViewProps>>>;
@@ -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>;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });