Giter Club home page Giter Club logo

web-app-from-scratch's People

Contributors

camille500 avatar sjoerdbeentjes avatar timoverkroost avatar

Watchers

 avatar

Forkers

lhafkamp

web-app-from-scratch's Issues

SPA navigation issue

If you load op the SPA, click on best practices, refresh the website, you'll see the introduction page. If you then click on BP you wont navigate to that page because the SPA thinks you're already there.

Events object

Currently you've got some functions for adding and reacting to events. You could put everything in a events object en init the listeners on app.init().

Utils Object

Currently, you've got functions like formatMoney en randomNumber. It would be nice to have these functions as methods of an utils object

PULL REQUEST (Dave Bitter) | Non re-usable functionality

My pull request is my advice in the form of an issue, otherwise I would re-write your code.

Currently the functionality is limited to two sections, old and new. You should get all the sections and check if the location.hash === section.id. This scales much better and is probably easier to read :).

Sidenote, use forEach for the looping through all the sections instead of a old for loop. A lot of people aren't using the awesome forEach loop yet

Use comments

It's hard for other developers to understand your code if there is not some explanation about what is going on.

DRY in if statements

You always call movieData.cleanList(movieList) at the end of every if statement, you can just call it once at the end.

            filterList(movieList, type) {
                if (type === 'highest_rating') {
                    movieList.results.sort(function(a, b) {
                        return b.vote_average - a.vote_average;
                    });
                    movieData.cleanList(movieList)
                } else if (type === 'higher_rating') {
                    movieList.results = movieList.results.filter(function(movie) {
                        return movie.vote_average > 5.5;
                    });
                    movieData.cleanList(movieList)
                } else if (type === 'most_votes') {
                    movieList.results.sort(function(a, b) {
                        return b.vote_count - a.vote_count;
                    });
                    movieData.cleanList(movieList)
                } else if (type === 'most_popular') {
                    movieList.results.sort(function(a, b) {
                        return b.popularity.toFixed(1) - a.popularity.toFixed(1);
                    });
                    movieData.cleanList(movieList)
                }
},

Cache API data

Cache all API data if it isn't necessary to do a call for

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.