240 likes | 446 Views
JavaScript Development Tools. Front-End Development. JS Development Tools. In order to work with JavaScript, we need to set up a couple of tools Many tools available; we wil go for a quite simple setup: Aptana Studio 3 Firefox browser, with Firebug extension. Aptana Studio 3.
E N D
JavaScript Development Tools Front-End Development
JS Development Tools • In order to work with JavaScript, we need to set up a couple of tools • Many tools available; we wil go for a quite simple setup: • Aptana Studio 3 • Firefox browser, with • Firebugextension
Aptana Studio 3 • We need a tool for creating and editing HTML and JavaScript files (not compiling) • In principle, we could just use Notepad… • We will only use Aptana Studio for • Creating and editing (smart editor) • Launching websites to Firefox
Aptana Studio 3 • Aptana Studio 3 is free, just download and install • Go to www.aptana.com, download and install the version for your OS
Aptana Studio 3 Open a file: File | Open File
Aptana Studio 3 • The Aptana Studio editor provides ”smart” facilities like: • Color coding of page elements • Auto-generation of closing tags • Auto-completion for JavaScript methods, properties, etc.. • …and probably a lot of other stuff we are not really going to use
Aptana Studio 3 If you do not like the default color scheme: Choose Themes (the ”color-wheel” icon), and choose a different theme. Current theme is greyed out
Firefox Browser • Aptana Studio cannot ”run” (display) a website for you – we need a browser for that • What to choose… • We will use Firefox, mainly because of the Firebug plug-in (later) • Go to www.firefox.com, and install Firefox on your PC
Firefox Browser • Once you have installed Firefox, you can set it as the default browser used by Aptana Studio • This is done by choosing the menu Run, and then Run Configurations
Firefox Browser 2) Click ”New Launch Configuration” 1) Select ”Web Browser”…
Firefox Browser 1) Enter a name for the new Run configuration 2) Browse to the Firefox executable 3) Leave rest as-is…
Firefox Browser • When we now wish to run (display) a website, we should: • In the editor, go to that .html page which is the main page of the website (in our examples, we will typically only have only .html page) • Choose the menu Run, then Run (or Ctrl + F11, or click the green ”Run” icon)
Firefox Browser • NOTE: A classic mistake: • You edit some JavaScript (a .js file) • You save, and wish to see the website… • …so you click Run, while displaying the .js file in the editor • This will NOT launch the website, but just show the JavaScript directly in the browser • REMEMBER to shift to the .html page in the editor
Firebug extension • If we always created error-free websites, this would be all we needed… • Aptana Studio cannot really help us with ”dynamic” errors, i.e. JavaScript errors • The Firebug extension to Firefox can help us with this! • Go to getfirebug.com , and install Firebug
Firebug extension • Once Firebug is installed, you can start it in Firefox by: • Pressing F12, or • Clicking on the Firebug icon in the upper right corner
Firebug extension • You can display the Firebug window either as part of the browser window, or in a separate window (I prefer at the bottom of the screen )
Firebug extension We can show/inspect various webpage element, like e.g. JavaScript
Firebug extension We can even debug JavaScript, using breakpoints, single-stepping, etc.
Firebug extension In the Watch window, we can observe values of variables, etc (also mouse-over)
Try it out! • Make sure you have all the below installed: • Aptana Studio 3 • Firefox browser • Firebug extension • Do JavaScript Exercise 01 (see class website)