Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. The following are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "The onLoadStarted
event will be triggered when PhantomJS starts loading the page based on the resources received."
A block of code is set as follows:
var system = require('system'); var url = system.args[1]; var page = require('webpage').create(); page.onLoadStarted = function () { console.log('Page Loading Started'); }; page.onLoadFinished = function () { console.log('Page Loaded'); phantom.exit(0); }; page.open(url);
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)
Any command-line input or output is written as follows:
$ ./phantomjs pageload3.js http://www.google.com Loading takes 6.751 seconds. 0.255 seconds : http://www.google.com/ 0.379 seconds : http://www.google.com.ph/ 0.213 seconds : http://ssl.gstatic.com/gb/images/b_8d5afc09.png 0.676 seconds : http://www.google.com.ph/images/srpr/logo1w.png 0.561 seconds : http://www.google.com.ph/images/srpr/nav_logo80.png 6.135 seconds : http://www.google.com.ph/xjs/_/js/hp/sb_he,pcc/rt=j/ver=_aDh7zAWqI8.en_US./d=1/sv=1/rs=AItRSTOgg467Qcx4GftzMMz3ZDPd84lcog
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, for example, appear in the text like this: "Using a simple page open, handling these two events will give us two console prints: Page Loading Started which is displayed first, followed by Page Loaded."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.