Adding a List of Earthquakes
The first feature in the new dashboard is to display a real-time list of earthquakes, including information about their locations, magnitudes, and dates. The data for this list is the same as for the map, which comes from the USGS website. We’ll first create a function that returns a row element given a props object parameter:
| function makeRow(props) { |
| var row = document.createElement('tr'); |
| row.id = props.net + props.code; |
| |
| var date = new Date(props.time); |
| var time = date.toString(); |
| [props.place, props.mag, time].forEach(function(text) { |
| var cell = document.createElement('td'); |
| cell.textContent = text; |
| row.appendChild(cell); |
| }); |
| |
| return |
Get Reactive Programming with RxJS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.