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

Function postWebKitMessage

packages/shared/src/lib/ios.ts:48–69  ·  view source on GitHub ↗
(
  handler: WebKitMessageHandlers,
  payload: T,
)

Source from the content-addressed store, hash-verified

46 messageHandlerExists(WebKitMessageHandlers.AppIconSet);
47
48export const postWebKitMessage = <T = unknown>(
49 handler: WebKitMessageHandlers,
50 payload: T,
51): void => {
52 const webkitGlobal = globalThis as IOSWebkitGlobal;
53
54 if (!isIOSNative()) {
55 throw new Error('sendMessage is only available on iOS');
56 }
57
58 if (!messageHandlerExists(handler)) {
59 throw new Error(`Message handler ${handler} does not exist`);
60 }
61
62 const messageHandler = webkitGlobal.webkit?.messageHandlers?.[handler];
63
64 if (!messageHandler) {
65 throw new Error(`Message handler ${handler} does not exist`);
66 }
67
68 messageHandler.postMessage(payload);
69};

Callers 9

iosNativeAuthFunction · 0.90
NativeAppleSubProviderFunction · 0.90
getApplePricingFunction · 0.90
useStoreKitPaymentFunction · 0.90
IOSIconPickerFunction · 0.90
InternalAppFunction · 0.90
PlusInfoFunction · 0.90
trackSignupFunction · 0.90
trackEventFunction · 0.90

Calls 2

isIOSNativeFunction · 0.90
messageHandlerExistsFunction · 0.85

Tested by

no test coverage detected