javascript - Access anonymous functions in the console -
if javascript running, , have function in code:
var myobject= { foo: function() { } }; i can log calls function , alert in console when it's called submitting this:
myobject.foo = function(c) {alert('called!');} how can same if javascript method set follows:
! function(a) { a.someobj= function() { this.vara= {}, this.varb = {} }; var b = a.someobj.prototype; b.bar= function() { return 1 }, b.foo= function(b) { //do calc //i want add alert here. . . } }(anotherobj); what's type of method called , how can add line alert in developer tools console when it's called?
i don't know trying, perhaps might you:
var x={}; (function(a) { // alert(a.ich); a.someobj = { vara: {}, varb : {} }; var b = a.someobj; b.bar= function() { return 1; }; b.foo= function(b) { alert(b); }; })(x); x.someobj.foo("hi");
Comments
Post a Comment