The Deep End

go to graworks.com! email!

Tuesday, May 31, 2005

Thunderbird Extensions Documentation: Wielding the nsIEnumerator

This post deals with the two kinds of enumerators in Mozilla. nsISimpleEnumerator is really simple, and there's no reason to talk about that.

nsIEnumerator is really bizarre, and although this may seem obvious to everyone else, this might be helpful to anyone who's a little stuck.

Basically, nsIEnumerator runs happily until it crashes.

Here's some code that you can pretend is a while(friendlyAndNice.hasNext()) loop:
var keepGoing = 1;

blah

try{
nseSubFolders.first();
}catch(e1){
keepGoing = 0;
}


while(keepGoing == 1){
thing = blah.currentItem();


try{
nseSubFolders.next();
}catch(e2){
keepGoing = 0;
}
}

4 Comments:

Post a Comment

<< Home