( handler: WebKitMessageHandlers, payload: T, )
| 43 | }; |
| 44 | |
| 45 | export 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 | |
| 62 | export const setNativeHandlers = (handlers: NativeHandlers | null): void => { |
| 63 | const nativeGlobal = globalThis as NativeGlobal; |
no test coverage detected