Is is possible to listen if a function was fired up in another .js file?

For example `function foo()` was fired.

Is it possible to run a piece of code everytime `foo()` is run without placing the code I want to run within that function?