On Mar 12, 4:01 pm, "tradiate" <[EMAIL PROTECTED]> wrote: > On Mar 11, 11:25 am, [EMAIL PROTECTED] wrote: > > > snip > > > Try using the "JavaScript global constructor" category technique. > > There is a code snippet here describing how to do > > it:http://weblogs.mozillazine.org/weirdal/archives/017188.html > > Thanks. This is helping me move forward. After havinf my object self- > register as a "JavaScript global constructor" I no longer get the > error I originally mentioned, but if I execute JS that resembles this: > > var foo = new MyObj(); > foo.mymethod(); > > now I get this: > > JavaScript Error: "foo.mymethod is not a function" > > What am I missing here?
I have a suspicion that you need to QueryInterface | foo | to | Components.interfaces.myInterface | like this: var foo = new MyObj(); foo.QueryInterface(Components.interfaces.myInterface); foo.mymethod(); _OR_ you could support nsIClassInfo, like the FeedWriter example I gave a link to. Here is where FeedWriter implements nsIClassInfo: http://mxr.mozilla.org/seamonkey/source/browser/components/feeds/src/FeedWriter.js#963 also note the QueryInterface implementation: http://mxr.mozilla.org/seamonkey/source/browser/components/feeds/src/FeedWriter.js#981 _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
