简体   繁体   中英

Atom simple console.log?

I tried everything and amazingly I couldn't find a way to do such a simple thing- show inside Atom the logs of my program.

console.log(" just a simple log")
  1. if you go to view->developer->toggle developer tools a Chrome like console will be open, but log will not be displayed, and its not a good UI.

  2. Tried to install any kind of package output-panel , console , console-log none of them will show my logs.

If I open the index.html in Chrome I see all my logs as expected.

Why I can't see a simple log ?

The console you see is atom's console . Atom is written in JavaScript itself, with the console you can debug the editor, plugins etc. You won't see the log you've written, because no one executes your code. If you open the script as part of a webpage in Chrome, Chrome executes the script.

You could use the script plugin to run the file directly from within atom.

I had the same problem and I figured it out myself. You really don't need an Atom JS console to see the results of your console.log commands as long as your program runs in a browser's window. You only need the console window that is already embeded in your browser. Here is how to do it:

  1. Open the web server page (fake or real) in your browser that shows the results of your program.
  2. In the web server page press Ctrl + Shift + J to toggle the developer tools (DevTools) window.
  3. Press the "Console" tab.
  4. Press the three vertical dots to the right of the DevTools window and then press the 3rd button with the caption "Dock to bottom", or leave it as it is if you prefer.

Now each time your javascript code executes a console.log command the result will be displayed in the console window.

I know i'm late, but Install "Script" by atom in the package installer and it supports almost all languages so just press cmd+I for Mac and ctrl+I for Windows.

Edit: This is only for running script inside of the Atom-editor, if you have linked it to a web then this is unnecessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM