Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Xpcom component in Javascript

8 views
Skip to first unread message

Shwetabh Mittal

unread,
Nov 28, 2006, 4:08:55 AM11/28/06
to dev-te...@lists.mozilla.org
I have created an XPCOM component in Javascript

The component is being implemented by a JS file. e.g 1.js
My question is that, is there a way to call a function in another js file
e.g 2.js from the file 1.js?

Thanks
--
Shwetabh

James Newell

unread,
Nov 29, 2006, 12:18:55 AM11/29/06
to
Yes...

objScriptLoader =
Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);

objScriptLoader.loadSubScript(strURL);

will include another JS file. Note I haven't tried it in an XPCOM
component.

See
http://www.xulplanet.com/references/xpcomref/ifaces/mozIJSSubScriptLoader.html

James

0 new messages