User Tools

Site Tools


developer_center:recipe_book:extensions_and_core:service_pane:enumerating_nodes

Enumerating Nodes

The following recipe walks the Service Pane nodes (from the root) and prints out the name of each node.

const Ci = Components.interfaces;
const Cc = Components.classes;

function printTree(node) {
    if (node.displayName)
        alert(node.displayName);
	
    for (var child = node.firstChild; child; child = child.nextSibling) {
        printTree(child);
    }
}

var SPS = Cc["@songbirdnest.com/servicepane/service;1"].getService(Ci.sbIServicePaneService);   
printTree(SPS.root);
developer_center/recipe_book/extensions_and_core/service_pane/enumerating_nodes.txt · Last modified: 2013/12/28 10:29 by geekshadow