Any command registered with Venkman's command manager can be placed in a menu. The menuSpecs property of the console object defines the list of menus available in Venkman.
Venkman's Debug menu is shown in the example below. The label property is a string containing the textual label for this menu. In this example, MSG_MNU_DEBUG is the string ``&Debug''. The items property is an array of commands to include in the menu.
The first column in the items array is either a command name, a menu name, or a spacer. Menu names are differentiated from command names by a leading greater-than character, '>' (notice the ">popup:emode" entry in the example.) A spacer is denoted by a dash, '-'.
| Condition | Meaning |
|---|---|
| enabledif | Must evaluate to true in order for the menu item to be enabled. |
| visibleif | Must evaluate to true in order for the menu item to be shown in the menu. |
| checkedif | If the condition evaluates to true, the checked attribute of this menu item will be set, otherwise the attribute will be removed. |
function initMenus()
{
<... snip ...>
console.menuSpecs["mainmenu:debug"] = {
label: MSG_MNU_DEBUG,
items:
[
["stop",
{type: "checkbox",
checkedif: "console.jsds.interruptHook"}],
["cont"],
["next"],
["step"],
["finish"],
["-"],
[">popup:emode"],
[">popup:tmode"],
["-"],
["toggle-chrome",
{type: "checkbox",
checkedif: "console.prefs['enableChromeFilter']"}]
]
};
<... snip ...>
}