Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox Extensions - best practices [closed]

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!

like image 917
Graham Avatar asked Oct 12 '09 12:10

Graham


People also ask

Do extensions slow down Firefox?

Just as too many unneeded apps will slow down your computer, too many plug-ins and extensions can do the same to your browser. They take up system resources and can even cause bugs and crashes.

Are Firefox recommended extensions safe?

Recommended extensions differ from other extensions that are regularly reviewed by Firefox staff in that they are curated extensions that meet the highest standards of security, functionality, and user experience.

Do I need privacy badger with Firefox?

Is Privacy Badger compatible with Firefox's built-in content blocking? It's fine to use Firefox's native content blocking and Privacy Badger together. While there is overlap between Firefox's tracker lists and Privacy Badger's protections, unlike list-based blockers, Privacy Badger automatically discovers trackers.

Do Firefox extensions work in private mode?

Extensions in private windows Firefox lets you decide which extensions are allowed to run in private windows. Additionally, an extension is not enabled for private browsing by default. You must grant it permission, either during installation or later through the extension's settings.


2 Answers

Peter Michaux explains Javascript namespacing very nicely.

like image 144
kangax Avatar answered Sep 20 '22 03:09

kangax


You can have a look at this video from Google tech, which explains best practices for JavaScript coding which is a main part of Firefox extension development

http://www.youtube.com/watch?v=0LKDImgRfrg

alt text http://0.gvt0.com/ThumbnailServer2?app=vss&contentid=4d0ae57a8484fdf8&offsetms=275000&itag=w160&hl=en&sigh=GnGo87Drht4wi2JvP1L0PtvKT4M

like image 31
Xinus Avatar answered Sep 21 '22 03:09

Xinus