¿Cómo puedo acceder a las variables compiladas de CoffeeScript a JS en la Consola de JavaScript de Chrome Developer Tools?
Frecuentes
Visto 110 veces
0
I have a Rails app with a CoffeeScript file. The Rails Asset Pipeline compiles it into a JavaScript file.
I'd like to open up the Chrome Developer Tools JavaScript Console and execute functions defined in my .coffee
archivo.
However in the compiled JS it's all wrapped up like this...
(function() {
var youLot = function() {
return "Wot?";
};
}).call(this);
So what happens in the JS console...
youLot();
ReferenceError: youLot is not defined
Without going through too many contortions, is there a way I can call youLot()
in the Chrome JS console even though I originally declared it in a CoffeeScript file?
1 Respuestas
0
Creo que quieres:
window.myVariable
But, I recommend you read up on coffee scripts handling of scope. SO referencia
contestado el 23 de mayo de 17 a las 13:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas javascript ruby-on-rails coffeescript google-chrome-devtools or haz tu propia pregunta.