Code Monkey home page Code Monkey logo

collection's Introduction

Hey all ๐Ÿ‘‹

Henry here.

8 years ago I change careers from illustrator => ui designer => web developer. Currently building web applications with cross-functional teams.

Personal Website: iammrvilla

collection's People

Watchers

 avatar  avatar

collection's Issues

Reduce class size by extracting respective render logic

handleMovieData(movieData, bookData, albumData, comicData) {
console.log('movieData: ', movieData);
this.renderSearchFilmTemplate(
movieData.Poster,
movieData.Title,
movieData.Rated,
movieData.Genre,
movieData.Runtime,
movieData.Plot,
movieData.Director,
movieData.Writer,
movieData.Actors,
movieData.Year
);
console.log('bookData: ', bookData);
this.renderSearchBookTemplate(
bookData.items[0].volumeInfo.title,
bookData.items[0].volumeInfo.imageLinks.thumbnail,
bookData.items[0].volumeInfo.authors,
bookData.items[0].volumeInfo.categories,
bookData.items[0].volumeInfo.ratingsCount,
bookData.items[0].volumeInfo.pageCount,
bookData.items[0].volumeInfo.publishedDate
);
console.log('albumData: ', albumData);
this.renderSearchAlbumTemplate(
albumData.results[1].title,
albumData.results[1].cover_image
//albumData.results[0].artist,
);
console.log('comicData: ', comicData);
}

This should actually be the last method (except for the render method) in this class. Try and extract the respective render logic into its own place (class, function, ...) and import that. This way, this class does not have to know about the how (check out Law of Demeter, Single Responsibility Principle)...

Low level ajax call

var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log('goodreads:', this);
}
});
xhr.open("GET", `https://www.goodreads.com/search/?key=OdApwh4IJ7zOqXbUspaow&q=${searchQuery}`);
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("Access-Control-Allow-Origin", "http://localhost:3000");
xhr.send(data);

Are we doing anything with this? We don't need to go so low-level here, because fetch abstracts all of that away.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.