welcome: please sign in
location: Modules

This document describes the module system that was introduced with version 0.9.2.

glossary

application (or global) scope

This refers to the scope of the singleton conkeror object, defined in components/application.js.

feature

A symbol (given as a string) added to the features list by a module, which other modules can use to tell if that module has been loaded. Features should be lower case, using only hyphens for punctuation. A module which provides a given feature should have that feature name as its file name, plus a .js extension.

load

The default behavior of load is to try to load the module directly into application scope.

require

Require is simply a conditional load. Require parses passed module spec (filename) and guesses what feature that file provides. If that feature has already been provided, it returns without loading. The default behavior of require is to try to load the module in its own namespace.

Optional Modules

to-do: rewrite this bit as a concise description of Optional Modules

Conkeror has a number of core module that are required for Conkeror to run and which are always loaded at startup. In addition, though, there are a growing number of optional modules that provide additional functionality. Such modules include

Certain Mozilla preferences are used to specify which, if any, of these optional modules are loaded at startup. Specifically, whether a particular module <module-name>.js (where <modules-name> might be extensions/dom-inspector as an example) is loaded automatically at startup (note that you can also load modules explicitly in your ConkerorRC file, and that is unrelated to these preferences) is controlled by the three preferences

The module is loaded according to the following rules:

Modules that meet these condiions are loaded in an arbitrary order consistent with their dependencies (where the dependencies are given by any calls to the require function in the module itself).

Note that the conkeror.loadModules preference only has an effect if conkeror.loadDefaultModules is non-positive. It can be useful for concisely specifying that only certain classes of modules are desired by default. For example, if it is set to "(bindings/default|extensions|page-modes)/.*", exactly the set of modules in the directories bindings/default/ (the default key bindings), extensions/ (extension support modules), and page-modes/ that have a conkeror.load.<module-name> preference set to a non-negative value (all modules by default) will be loaded automatically at startup.

Conkeror.org: Modules (last edited 2010-03-23 15:17:32 by retroj)