Home > xpcomcore

xpcomcore

Xpcomcore is a project mainly written in ..., based on the MIT license.

XPCOM "Core" library emulating many of the features available in the standard Ruby one.

XPCOMCore

A standard library like Ruby's, only for JavaScript (with XPCOM access).

Installation

Check out / submodule in / whatever the code to a place of your choosing. Then load it from an XPCOM component like so:

Components.utils.import("resource://app/chrome/content/vendor/xpcomcore/bootstrapper.js");

Then, to pull XPCOMCore into your scope, do this lovely little trick:

XPCOMCore({scope: this});

If you wish to not automatically mix in the Kernel module, pass another argument like so:

XPCOMCore({scope: this, importKernel: false});

Then, whenever you want to make use of XPCOMCore (say, from a XUL window), do the same deal. For example:

<script type="text/javascript">XPCOMCore({scope: this});</script>

Then you'll have access to methods such as load() and require() and whatever else is defined in Kernel.

  • Gabriel Gironda