Re: How to invoke a C++-'Listener' via Javascript?
[email protected] (timmy) 16 Oct 2002 23:58:21 -0700
| Newsgroups | gmane.comp.mozilla.devel.xpcom |
|---|---|
| Organization | http://groups.google.com/ |
| Message-ID | <[email protected]> |
Adam Fletcher <[email protected]> wrote in message news:<[email protected]>... > Timm, > > Say you have a <browser> tag in your in your XUL, with an id of > "The-Browser". Here's what you would need to do in javascript to provide > a listener for loading/etc: > > var br = top.document.getElementById("The-Browser"); > br.webProgress.addProgressListener(downloadProgressListener, > Components.interfaces.nsIWebProgress.NOTIFY_ALL); > br.webNavigation.document.location = "http://www.example.com/"; > > // and downloadProgressListener is: > var downloadProgressListener = { > onStateChange: function(webProgress, request, stateFlags, status) { > dump("OnStateChange"); > }, > onProgressChange: function(webProgress, request, curSelfProgress, > maxSelfProgress, curTotalProgress, > maxTotalProgress) { > dump("onProgressChange, curSelfProgress: " + curSelfProgress + > " maxSelfProgress: " + maxSelfProgress + > " curTotalProgress: " + curTotalProgress + > " maxTotalProgress: " + maxTotalProgress); > }, > onStatusChange: function(webProgress, request, status, message) { > dump("OnStatus"); > }, > onSecurityChange: function(webProgress, request, state) { > dump("OnSecurity"); > }, > QueryInterface: function(iid) { > if(!iid.equals(Components.interfaces.nsIWebProgressListener) && > !iid.equals(Components.interfaces.nsISupportsWeakReference)) { > throw Components.results.NS_ERROR_NO_INTERFACE; > } > return this; > } > }; > > // the end > -- > That should help you out. > > -Adam > > timmy wrote: > > Hi, > > > > My task is an embedded application which uses gecko as layout-engine > > for the gui. I dynamically generate documents using DOM-methods on the > > C++-side. I want javascript-code to call a c++-object about the action > > in the browser. I have not much time in reading the complete > > sourcecode of mozilla, because my employee wants it to be done in one > > week, and i also don't find any accurate code-examples. > > > > Can anyone help me with this task with some code-examples from both > > the C++ and javascript side? > > > > many thanx > > Timm that's it, thank you very much!!!