5
Explaining my scenario, using emberjs, and it encapsulates each Component
within a Controller
that will be encapsulated inside a Router
, and still has a scheme of Model
, Mixins
, Helpers
, when there is no component, or addon, or mixin chatting with another component, addon, mixin (welcome to modern javascript).... Sometimes it is very difficult to debug the code, know the javascript path path, the scope in which such a function or method was called, using the console.debug();
I can get the current scope of the function, but it’s hard to know where that function was called from. Is there any method or javascript mode to find out all the way the function has traveled to reach a certain point?
Exemplifying:
function A(){
B();
}
function B(){
a.teste();
}
function C(){
/*Descobrir como o javascript chegou até aqui*/
console.log("Hellor Weird World!");
console.debug();
}
var a = {
teste: function(){
C();
}
}
A();
This would be very useful, I do via element inspector, of course it already has to be open before the function perform, but the big problem is when they use
.call
or.apply
, as jQuery does, there is almost impossible to find :/ (I don’t know why)– Guilherme Nascimento
A strange way, but that works is
console.log(new Error().stack);
, which is basically the suggested in this answer on Soen– Isac