@react-native-webview-rpc/web
Version:
A type-safe RPC between React Native function and JavaScript inside WebView, powered by Comlink
16 lines (15 loc) • 303 B
JavaScript
import * as Comlink from "comlink";
import { webViewRpcEndpoint } from "./endpoint";
function wrap() {
return Comlink.wrap(webViewRpcEndpoint, {});
}
function safeWrap() {
if (typeof window.ReactNativeWebView === "undefined") {
return null;
}
return wrap();
}
export {
safeWrap,
wrap
};