[webkit-help] How to raise asynchronous events from C++ to JavaScript

Programming Newbie newbie.programming at yahoo.com
Sat Jan 19 13:47:58 PST 2013


Hi,

Thanks Tim.

This means if event is to be raised on my own class, say MyClass, then it has to implement some kind of Event interface.

Is there any specification/document/example that details how this can be done.

Sending it again, as did not send it to mailing list first time.


________________________________
 From: Tim Mahoney <tim.mahoney at me.com>
To: webkit-help at lists.webkit.org 
Sent: Saturday, 19 January 2013, 20:12
Subject: Re: [webkit-help] How to raise asynchronous events from C++ to JavaScript
 
If JS calls "addEventListener", then eventually EventTarget::addEventListener will be called.
I believe what you want to do is call EventTarget::dispatchEvent on the node in question. 
This should call any callbacks associated with the type of event you pass to it.

I sent this reply before, but the title was incorrect. Hopefully this shows up nicely.

On Jan 19, 2013, at 12:00 PM, webkit-help-request at lists.webkit.org wrote:

> Send webkit-help mailing list submissions to
>     webkit-help at lists.webkit.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>     http://lists.webkit.org/mailman/listinfo/webkit-help
> or, via email, send a message with subject or body 'help' to
>     webkit-help-request at lists.webkit.org
> 
> You can reach the person managing the list at
>     webkit-help-owner at lists.webkit.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of webkit-help digest..."
> 
> 
> Today's Topics:
> 
>   1. How to raise asynchronous events from C++ to    JavaScript
>      (Programming Newbie)
>   2. Retrieve downloaded images (OC)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 18 Jan 2013 20:24:25 +0000 (GMT)
> From: Programming Newbie <newbie.programming at yahoo.com>
> To: webkit-help <webkit-help at lists.webkit.org>
> Subject: [webkit-help] How to raise asynchronous events from C++ to
>     JavaScript
> Message-ID:
>     <1358540665.61012.YahooMailNeo at web171506.mail.ir2.yahoo.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi,
> 
> 
> 
> I have managed to expose C++ APIs to JS using JavaScriptCore and I am able to issue callbacks from JavaScript to C++.
> 
> Now, I wanted to raise certain events in C++ and hoping them to be received in JavaScript.
> 
> So, if in JS, someone has added code:
> 
> myElement.addEventListener("myEvent", myEventHandler(), ...)
> 
> Then, I should somehow be able to raise myEvent from C++ and want it to be passed to JavaScript(caught in JS), so that myEventHandler() gets called.
> 
> Firstly, I thought of creating callbacks for all event handler functions and calling correct event handler them from C++ whenever an event needs to be raised.
> But, if I do like it, then I need to know beforehand which event handlers are associated with which events and I can't register and deregister events on the fly.
> 
> Also, there might be more than one handler associated with some events.
> 
> JavaScript code is not mine, I have to work with already written scripts and not allowed to modify them. So, I have to find out some way to do it through c++ only.
> 
> Can anyone please expain to me, how I can do this.
> 
> Thanks,
> newbie.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20130118/44e6fe9e/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 18 Jan 2013 23:03:24 +0100
> From: OC <oc.spam.3454 at laposte.net>
> To: webkit-help at lists.webkit.org
> Subject: [webkit-help] Retrieve downloaded images
> Message-ID: <50F9C6AC.1000006 at laposte.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Hello,
> 
> Is it possible to retrieve the images of a web page than has just been 
> downloaded? How?
> 
> For example, with QtWebKit and Python, I run:
> 
> from PyQt4.QtGui import QApplication, QImage
> from PyQt4.QtWebKit import QWebView
>  app = QApplication([])
> view = QWebView()
> view.load(QUrl("http://www.google.com"))
> view.show()
> 
> In this operation, the image "www.google.com/images/srpr/logo1w.png" was 
> downloaded and displayed. Where is it accessible now? How can it be 
> retrieved with webkit (or QtWebKit)?
> 
> Thank you,
> 
> O.C.
> 
> 
> ------------------------------
> 
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-help
> 
> 
> End of webkit-help Digest, Vol 43, Issue 9
> ******************************************

_______________________________________________
webkit-help mailing list
webkit-help at lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20130119/dad8f119/attachment-0001.html>


More information about the webkit-help mailing list