Firefox Extensions - best practices

firefox-addon, javascript

Solution

Peter Michaux explains Javascript namespacing very nicely.

Problem

I've been writing a Firefox extension, but have recently read a few articles explaining that it's bad practice to avoid variable name clashes by simple appending the application name to the front of the variable. Unfortunately I have been doing this. What is the best practice instead? I assume it's to somehow namespace the variables. I've found various articles about wrapping everythign in a master object, but sadly no examples of this. Can anyone point me to a good tutorial, or even a simple extension, that uses best-practices? Thanks!

Original source