Headbang: I had a typo in all the magic as e.ports[0] is the right way to access the port.
Sorry for the noise... [email protected] a következőt írta (2020. október 5., hétfő, 19:29:07 UTC+2): > > Hi All, > > I'm experimenting with a relatively tricky scenario: > > > https://stackoverflow.com/questions/41753104/how-do-you-use-webmessageport-as-an-alternative-to-addjavascriptinterface > > or its github source: > > https://github.com/commonsguy/cw-omnibus/tree/master/WebKit/SensorPort > > It works fine with normal html+js pages but I decided to do the same with > a qt/qml app compiled as webassembly. Seems to work till the point when the > EM_ASM block gets called where the global (window) onmessage function gets > registered: > > EM_ASM( > var port; > onmessage=function(e){ > port=e.port[0] > } > ); > > That onmessage gets called from java via webview postWebMessage(...) fine > but it seems that the parameter that is passed into postWebMessage(...) > goes through a JSON.parse and what I get in the incoming 'e' event is just > an: > > {isTrusted: true} > > So the function fails with not being able to access property 0 of > undefined. > > Does anyone know why the event object does not arrive as expected? > > Thanks®ards, > r0ller > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/783b5493-d843-47c0-9548-b054fdf177fcn%40googlegroups.com.
