MozillaZine

Reusable javascript components

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

Post Posted December 5th, 2005, 10:46 am

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.

Philip Chee

User avatar
 
Posts: 6475
Joined: March 1st, 2005, 3:03 pm

Post Posted December 5th, 2005, 11:31 am

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

Post Posted December 5th, 2005, 11:48 am

Random lurking in #developers for the win!

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 0 guests