I'm trying to add the jQuery library in the javascript module jquery.jsm. I'm using jquery.jsm in other modules. jQuery requires a window object, so I can not use the original jQuery code. I need to define a window object.
jquery.jsm:
const EXPORTED_SYMBOLS = ['jQuery'];
var xjQuery = null;
var window = null;
var location = null;
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
var enumerator = wm.getEnumerator(null);
if (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
window = win;
location = win.location;
}
How use original jQuery file in other modules? I was guided by this post - https://forum.jquery.com/topic/jquery-1-4-2-inside-a-firefox-extension