Fork me on GitHub
#clojurescript
<
2022-10-10
>
Ryan22:10:14

Can anyone help me figure out how to call

document.webkit.messageHandlers.closeDialog.postMessage("test")
It seems incredibly difficult to get a cljs repl running in mobile safari embedded in a WKWebKitView 😕

Ryan22:10:37

I've tried (.. js/document -webkit -messageHandlers -closeDialog postMessage "test")

Ryan22:10:06

The document.webkit object is nil unless your WKWebkitView has attached the necessary machinations to interact with the javascript context

dpsutton23:10:07

wouldn’t this be (.. js/document -webkit -messageHandlers -closeDialog (postMessage "test"))

Ryan23:10:51

Thanks I'll give it a try! I havn't written much interop and boy it makes my brain hurt a bit lol

thheller06:10:34

to make it extra easy do (js/document.webkit.messageHandlers.closeDialog.postMessage "test")

☝️ 1
🙏 1
Ryan14:10:21

Other than getting the path wrong (webkit puts the message handlers on the window instead of the document) it works a treat now! Thanks for the help folks! 🙂