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

Function postWebKitMessage

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

Source from the content-addressed store, hash-verified

56 messageHandlerExists(WebKitMessageHandlers.AppIconSet);
57
58export const postWebKitMessage = <T = unknown>(
59 handler: WebKitMessageHandlers,
60 payload: T,
61): void => {
62 const webkitGlobal = globalThis as IOSWebkitGlobal;
63
64 if (!isIOSNative()) {
65 throw new Error('sendMessage is only available on iOS');
66 }
67
68 if (!messageHandlerExists(handler)) {
69 throw new Error(`Message handler ${handler} does not exist`);
70 }
71
72 const messageHandler = webkitGlobal.webkit?.messageHandlers?.[handler];
73
74 if (!messageHandler) {
75 throw new Error(`Message handler ${handler} does not exist`);
76 }
77
78 messageHandler.postMessage(payload);
79};
80
81export const requestIOSTracking = (): void => {
82 if (!messageHandlerExists(WebKitMessageHandlers.RequestTracking)) {

Callers 13

postNativeMessageFunction · 0.90
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
requestIOSTrackingFunction · 0.85
requestIOSReviewFunction · 0.85

Calls 2

isIOSNativeFunction · 0.90
messageHandlerExistsFunction · 0.85

Tested by

no test coverage detected