--------------------------------------------------
var namespace = new function() {
return {
i: 0,
var: 'bar',
function1: function( ) {
alert("inside function 1");
namespace.function2( );},
function2: function( ) {
var j = 0;
alert("inside function2"); }
};
}
------------------------------------------------
when i invoke namespace.function1(), i get this error in Error
Console ::
Error: namespace is not defined
Source file: chrome://browser/content/browser.xul
Line: 1
please let me know where im going wrong !!
- Thanks in advance
I'm not very experimented in js, but I would have done:
namespace.prototype.function1 = function() {
.....
}
namespace.prototype.i = 0;
etc.
is that different from what you are requesting?
regards
seb
> _______________________________________________
> dev-extensions mailing list
> dev-ext...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-extensions
>
Or even simpler,
var namespace =
{
function1: function()
{
};
};
jjb