Hi,
when we create a function (eg. var foo = function() {...} or
function foo() {...}), the body of the function is stored in some
place. I thought that this body is stored in "prototype.constructor"
but i am wrong because if we see the following code:
...
var foo = function () { print("foo"); }
var foo1 = foo.prototype.constructor:
foo.prototype.constructor = { print ("super foo");};
foo();
foo1();
...
the code output is :
foo
foo
that is to say, i have a reference to function when i use
"prototype.constructor" but when i modify the "prototype.constructor"
the function body does not change. does somebody know why i cannot
modify the function? is it possible to make that?
why do i need this?
Because i have some listeners or hooks in the prototype that work
fine. So, when a function is created i think that the
prototype.constructor is accessed and using my listeners or hooks i
could modify the function to add some code.
Thank in advance.
Paul Leger.
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network