Reusable javascript components

Talk about add-ons and extension development.
Post Reply
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Reusable javascript components

Post by Ted Mielczarek »

Holy crap, I hadn't seen this bug, and it has a patch and everything!

bug 238324 - Implement JavaScript code-sharing module system

Basically it lets you do something like:

in foo.js:

Code: Select all

function fun() {
...
}


in bar.js:

Code: Select all

Components.utils.importModule('foo.js')

fun();


The difference between this and using a subscript loader solution is that foo.js will only be loaded and evaluated once no matter how many times it's imported. Way cool! Hopefully this will land on trunk soon.
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Post by Philip Chee »

Where do you find out stuff like this? Data mining Bugzilla?

Phil
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

Random lurking in #developers for the win!
Post Reply