Message from discussion
Firebug: watch private var
Received: by 10.52.33.209 with SMTP id t17mr2693526vdi.0.1336644306436;
Thu, 10 May 2012 03:05:06 -0700 (PDT)
X-BeenThere: firebug@googlegroups.com
Received: by 10.52.72.100 with SMTP id c4ls1658745vdv.3.gmail; Thu, 10 May
2012 03:04:59 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.52.69.48 with SMTP id b16mr152406vdu.13.1336644299067; Thu, 10
May 2012 03:04:59 -0700 (PDT)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
alphap...@gmail.com designates internal as permitted sender)
smtp.mail=alphap...@gmail.com; dkim=pass
header...@gmail.com
Received: by f30g2000vbz.googlegroups.com with HTTP; Thu, 10 May 2012 03:04:59
-0700 (PDT)
Date: Thu, 10 May 2012 03:04:59 -0700 (PDT)
In-Reply-To: <0823f3b7-6c5d-4dbc-96b2-adb7db87cddd@b1g2000vbb.googlegroups.com>
References: <e9608712-2f52-4d36-a6aa-025be460e8ed@l15g2000vbv.googlegroups.com>
<be28be85-1dde-4b84-a3a2-329bfe574f24@a5g2000vbn.googlegroups.com>
<d95081d6-e625-49a2-a2cc-3a6b0d5132ed@gn8g2000vbb.googlegroups.com> <0823f3b7-6c5d-4dbc-96b2-adb7db87cddd@b1g2000vbb.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0),gzip(gfe)
Message-ID: <2f0c5c14-6030-451c-8f54-3bddfb161c92@f30g2000vbz.googlegroups.com>
Subject: Re: Firebug: watch private var
From: AlphaPage <alphap...@gmail.com>
To: Firebug <firebug@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
I know I can bypass the problem, but it would be great to get private
var or return value from function more quickly.
I mean for example:
MyModule2 = function (strInput) {
if (false === (this instanceof MyModule2)) {
return new MyModule2();
}
var str = strInput;
this.getStr = function () {
return str;
}
this.customStr = "custom str";
};
document.getElementById("Button2").onclick = function () {
var module2 = new MyModule2("input");
console.log(module2.getStr());
debugger;
}
In the quick watch panel (very nice feature), this.customStr is
displaying "custom str" because it is public :perfect.
It's impossible to spy the str var because it is private. If I add a
watch, str var is undefined which is wrong because str="input".
So to get the str var, I use my public Getter function getStr(). The
quick watch panel shows getStr with a link to jump to the code (no
problem), but it would be perfect if another row helps to watch the
data returned when asked. I need to right click getStr, select "add
watch" then reformat the watch from "module2.getStr" to
"module2.getStr()" and finally get the data "input".
I think being able to spy private var and spy returned value from
function when needed would be a great feature to ease javascript
debugging.