How can i listen to a specific function call with parametters using javascript:
example : when showname(2) is called i can do something like call another function too, showage(2)
How can i listen to a specific function call with parametters using javascript:
example : when showname(2) is called i can do something like call another function too, showage(2)
You can't "hook" into arbitrary function calls, no.
you can wrap it:
update
you can do something similar with properties, using getters and/or setters:
into
encapsulated (private
_bar
):One way to do it is to add a callback to the function, for example define:
And call: