ddcornwall / nara-alaskana

National Archives Alaskana Explorer
1 stars 0 forks source link

Refactor AJAX with Fetch API #18

Open digilou opened 6 years ago

digilou commented 6 years ago

It sounds like ES6 promises open a whole new door for API calls. It may even offer better performance and security. I'd like to give it a shot later on in the project, once all the functionality has been worked out.

digilou commented 6 years ago

Note: this has the potential of opening up a can of worms, like installing Babel into our project....

ddcornwall commented 6 years ago

Promises for APIs? I'm intrigued. I'll probably want to take the udacity course you took so I'm sorta up to speed. But yeah, let's think about this for a future release.

Speaking of AJAX, I wanted to let you know that the json scripts now throw cross domain errors when working locally. It works in Edge locally and is still working on our GitHub pages. I'm guessing that's an update from Chrome.

ddcornwall commented 6 years ago

@digilou Do you expect promises to only affect our current JSON block? Might it have implications for the displayResults function? I'm thinking of doing some refactoring of the display code based on what I've learned in Practical JavaScript. I'm deciding whether I need to take the promises course before or after.

digilou commented 6 years ago

That's a good question @ddcornwall. I'm not sure, as I haven't evaluated your JS code all that closely. Refactoring is always a work in progress. I say, refactor, then worry about promises later.

digilou commented 6 years ago

Recently learned more about this in my Mobile Web Specialist class. The Fetch API is the modern way to handle these requests. It is not supported by IE 11 or Opera Mini, but there is a fetch polyfill available here on Github.

digilou commented 6 years ago

Looks like the non-nanodegree version for learning is available as a 3-week course: Asynchronous JavaScript Requests, which looks like the lessons I'm currently going through. Once I finish the Fetch lesson, I will have a better idea about how to implement this.

digilou commented 6 years ago

@ddcornwall I'm working on this right now, while Fetch is fresh in my mind from my Google/Udacity coursework.

digilou commented 6 years ago

Finished my nanodegree! So now I'm ready to get back to personal projects (like this) and apply what I've successfully learned.

ddcornwall commented 6 years ago

Congratulations on finishing the Nanodegree and thanks for taking another look at NARA Alaskana. - Danie

On Mon, Nov 12, 2018 at 5:04 PM Amy Carney notifications@github.com wrote:

Finished my nanodegree! So now I'm ready to get back to personal projects (like this) and apply what I've successfully learned.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ddcornwall/nara-alaskana/issues/18#issuecomment-438095927, or mute the thread https://github.com/notifications/unsubscribe-auth/AfPYQSYzMdy7XF7Qt90P_QA2htYDSRgGks5uuiFCgaJpZM4SyNZ2 .

--

Daniel Cornwall danielcornwall@gmail.com http://godort.libguides.com/alaskadbs