Chapter 3. Handling Events and Callbacks
A browser adapts based on user-driven events—these can be mouse or key events. A browser reacts by doing something when these events are received. Events are not only generated by the user as there are also events that are triggered and received by the application, such as an incoming message alert, a request to pick up a file, or incoming data packets over the network. PhantomJS has several webpage callbacks that we can listen to in order to perform additional processing when these events are received.