MCPcopy Create free account
hub / github.com/dailydotdev/apps / postNativeMessage

Function postNativeMessage

packages/shared/src/lib/nativeBridge.ts:45–60  ·  view source on GitHub ↗
(
  handler: WebKitMessageHandlers,
  payload: T,
)

Source from the content-addressed store, hash-verified

43};
44
45export const postNativeMessage = <T = unknown>(
46 handler: WebKitMessageHandlers,
47 payload: T,
48): boolean => {
49 if (!hasNativeHandler(handler)) {
50 return false;
51 }
52
53 if (isIOSNative()) {
54 postWebKitMessage(handler, payload);
55 return true;
56 }
57
58 androidBridge()?.postMessage(handler, JSON.stringify(payload));
59 return true;
60};
61
62export const setNativeHandlers = (handlers: NativeHandlers | null): void => {
63 const nativeGlobal = globalThis as NativeGlobal;

Callers 6

postReadingFunction · 0.90
openInSystemBrowserFunction · 0.90
useNativeBridgeFunction · 0.90
playHapticFunction · 0.85
setNativeStatusBarFunction · 0.85

Calls 4

isIOSNativeFunction · 0.90
postWebKitMessageFunction · 0.90
hasNativeHandlerFunction · 0.85
androidBridgeFunction · 0.85

Tested by

no test coverage detected