[Jslib] include JSLib in extension

Brian King brian at mozdev.org
Wed Jul 14 20:07:13 EDT 2004


Apologies, I'm only seeing this message now because a bunch of old 
emails to this list came through to me.

What we do with projects that have a jslib dependency is hook it into 
the web page install routine to launch both at the same time:

HTML
<a href="#" onclick="installPackage();">Install My Extension</a>

JS
function installPackage()
{
   if (typeof(InstallTrigger) != "object")
     return upgradeMessage();

   // fix this w/ instructions how to turn back on
   if (!InstallTrigger.updateEnabled())
     return upgradeMessage("XPInstall is not enabled or site is not 
added to 'hostperm.1' file");
   else
     InstallTrigger.install({'jslib lite production build' : 'jslib.xpi',
                             'My Package' : 'mypackage.xpi'}, postCheck);
}

I'm not sure this level of customisation is possible on 
update.mozilla.org though?

On 18.6.2004 12:33, Henrik Gemal wrote:

> My extension Launchy is using JSLib functions. So JSLib needs to be 
> installed for Launchy to work.
> 
> But since Launchy got listed on update.mozilla.org I got some complains 
> about Launchy doesn't work. This is of cause because people dont have 
> JSLib installed.
> 
> Now I like to include JSLib inside of Launchy. Can I do that and what's 
> the smartest way?
> 
> I've got it working by including a jslib directory inside my extension's 
> jar file. The jslib directory contains the files that I use, mainly 
> io/file functions.
> 
> So instead of:
> <script src="chrome://jslib/content/jslib.js"/>
> I use:
> <script src="chrome://launchy/content/jslib/jslib.js"/>
> 
> I also had to change JS_LIB_PATH in jslib.js from:
> const JS_LIB_PATH="chrome://jslib/content/";
> to:
> const JS_LIB_PATH="chrome://launchy/content/jslib/";
> 
> To be fair I also changed JS_LIB_VERSION in jslib.js from:
> const JS_LIB_VERSION="0.1.168";
> to:
> const JS_LIB_VERSION="0.1.168-modified";
> 
> Is this the best way to do it? Help!
> 


-- 
Brian King
www.mozdev.org - free project hosting for the mozilla community


More information about the Jslib mailing list