Skip to content

Commit

Permalink
Merge pull request AdaGold#3 from AdaGold/event-tracing
Browse files Browse the repository at this point in the history
Event tracing Activity
  • Loading branch information
Hamled authored Dec 15, 2016
2 parents 9bf5363 + a4a7a1b commit a5f4c1a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ Each of the following views should correspond to a color. ex: trip view is yello



### Tracing Events

**Activity:**
Use the worksheet that corresponds to all the
Cut out the squares and put the segments of code in order in which they are ran, based on that event happening

- When Button, 'See All Trips', is clicked
- When button, 'Make Reservation', is clicked

### Initial Page Load
**Activity:**
Some of our JavaScript is run immediately when the page loads, and some of it doesn't run until the user does something. To help understand which is which and in what order various things happen, let's leave ourselves a trail of breadcrumbs to follow. We'll start by looking at what does and doesn't happen when the page is first loaded.
Expand All @@ -157,6 +148,38 @@ Did things appear in the order you expected? Did you get any `does not print`s?

Now change your numbering to reflect the order that functions are called when various buttons are pressed.


## Tracing Events

**Activity**
It can be difficult to figure out when functions get called when we're listening to events and there's not one line of execution to follow. Now you and your partner will be diving into the events and the functions listening to those events in this Trek App.

### DOM Events

Using a whiteboard make a list of the DOM events each of the views are listening to and draw arrows to functions that the events trigger.

- When button 'See All Trips' is clicked
- When button 'Make Reservation' is clicked

![image of a DOM Event linked to a function](images/diagramEvents.png)

Now look at the event handler functions, do they invoke other events or functions? Diagram those as well.

### Backbone Events

Look at the listenTo calls in the initialize functions. Are any of the views listening to events on other objects, such as Models, Collections or Views?

Diagram those events as well.

### Check your work

Now cause the events to trigger, for example click on a trip, or add a reservation.

- Look at the console log messages you put in earlier for the Page Load activity.
- Did they print? Were they in the expected order? Why or why not?
- How many events did you identify? Check with a neighbor to see if they have the same.


## 4) Would this be a backbone app?


Expand Down
Binary file added images/diagramEvents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a5f4c1a

Please sign in to comment.