-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipes | tanisha | trek #37
base: master
Are you sure you want to change the base?
Conversation
TREKWhat We're Looking For
Great job overall! In my estimation there are two difficult things in JavaScript we've never had to do in Ruby/Rails:
Based on this submission I'd say you have a good handle on both. These topics will get substantially more complex as we continue to build bigger apps with more moving parts, so keep up the focus and hard work! |
}) // end .fail | ||
.always(function(){ | ||
console.log('always even if we have success or failure'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need these always
callbacks. I think of an always
much like the ensure
clause on Ruby's begin/rescue
blocks: useful every once in a very long while, and otherwise safe to omit.
const loadTrip = function loadTrip(id) { | ||
$.get(`https://trektravel.herokuapp.com/trips/${id}`, | ||
response => { | ||
let tripInfo = ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This callback ends up being quite long. It would probably be worthwhile to break some of the components out into separate named functions defined at the top of the file.
// EVENTS | ||
$('ul').on('click', 'p', function(){ | ||
const tripID = $(this).attr('data-id'); | ||
loadTrip(tripID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you define your handlers above and then register everything all in one place - good organization.
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
loadTrips()
function that only executes when a button is click. I define that function the beginning of my code and then invoke the function within a click event later on in the code