I have a callback scenario where a js object gets called by a C++ object
and then that js object must call a function in another .js script. I
am unable to get the js object to recognize the function in the other
.js script. Any ideas?
- I have a .xul script that includes two scripts a.js and b.js.
- a.js has two functions: create and notify. The create method
instantiates the IDummy interface defined in b.js and also instantiates
a C++ interface.
- a.js calls a method of the C++ object and passes the Dummy object
created from b.js
- The C++ object then calls an dummyMethod of Dummy in b.js which then
calls the notify function of a.js
I have gotten everything to work upto b.js calling the notify method of
a.js. When I add code to get b.js to know about a.js' notify method and
start mozilla, I get "[Exception... "[JavaScript Error: "notify is not
defined". The line in question is shown below from b.js.
function Dummy() {
this.notifyFunction = notify; <-- Causes error when loading
mozilla.exe
}
Dummy.prototype = {
dummyMethod: function () {
this.notifyFunction();
},
...
}
Thanks,
--
Greg Thokle