Souds like they are getting a Promise result from the framework and are not 
"await"ing for it. 


> Sent: Saturday, December 15, 2018 at 3:35 PM
> From: "Roland Hughes" <rol...@logikalsolutions.com>
> To: "Jason H" <jh...@gmx.com>
> Cc: interest@qt-project.org
> Subject: Re: [Interest] resturn string to javascript inside QWebEngineView
>
> Turns out the problem wasn't mine. Previously we had been using 
> websockets but now websockets are bad so went with Web channel. Honestly 
> believed the bug was mine since the captive Web site worked fine with 
> websocket previously. Turns out it wasn't. Latest "front end" code has 
> html, angular, javascript and half a dozen other things. Because of 
> that, when they execute a function which returns a string, it actually 
> doesn't wait for a response. Nice. When one of the developers forces a 
> 5-10 second delay between making the call and using the string passed 
> back, they get the value.
> 
> Thanks for your help though.
> 
> On 12/12/2018 3:55 PM, Jason H wrote:
> > I did this, in some abandoned work. Turns out QWebWhatever didn't do it 
> > right on iOS. It can't return a QVariantMap, you have to stringify it.
> >
> > Timer {
> >             id: testTimer
> >             interval: 1000
> >             repeat:false
> >             running: false
> >             onTriggered: {
> >                     webview.runJavaScript("try {testResult} catch (e) 
> > {'undefined'}", function (result) {
> >                             console.log('object', JSON.stringify(result));
> >                     });
> >                     webview.runJavaScript("try {JSON.stringify(testResult)} 
> > catch (e) {'undefined'}", function (result) {
> >                             console.log('stringified', 
> > JSON.stringify(result));
> >                     });
> >
> >             }
> >             onRunningChanged: console.log('running', running);
> >     }
> >
> >     WebView {
> >             id: webview
> >             anchors.fill: parent
> >             onLoadProgressChanged: {
> >                     console.log('loadProgress', loadProgress)
> >                     if (loadProgress == 100) testTimer.running = true;
> >             }
> >     }
> >
> >
> >> Sent: Wednesday, December 12, 2018 at 3:46 PM
> >> From: rol...@logikalsolutions.com
> >> To: interest@qt-project.org
> >> Subject: [Interest] resturn string to javascript inside QWebEngineView
> >>
> >> All,
> >>
> >> Having a massive brain spasm today. Can't remember how to correctly
> >> return a string from a function to javascript being run inside of
> >> QWebEngineView via QWebChannel. Long ago when I first did this we used
> >> QWebSockets but that had horrible nasty side effects and was banned
> >> from the project during my absence. Cannot find a link how to do this
> >> either.
> >>
> >> It appears the real problem is Javascript isn't recognizing the
> >> signature so refuses to call.
> 
> -- 
> Roland Hughes, President
> Logikal Solutions
> (630) 205-1593
> 
> http://www.theminimumyouneedtoknow.com
> http://www.infiniteexposure.net
> http://www.johnsmith-book.com
> http://www.logikalblog.com
> http://www.interestingauthors.com/blog
> http://lesedi.us
> 
> 
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to