Code Monkey home page Code Monkey logo

pokestats's Issues

Refactor PokeApi Service Worker into Workbox

Created this issue to refactor the current existing code in pokeapi-sw.js based on the pokeapi-js-wrapped service worker.

The objective here is to create code consistency between this logic and the rest of the Workbox routes. When I tried to emplement similar logic with Workbox, the service worker is saving all the opaque responses and thus, generating massive cache sizes and quickly filling the storage quota.

When I try to filter out the opaque responses that have status code 0 with Workbox's CacheableResponsePlugin, even though the image responses return with status code 200, they are not getting cached.

Screenshot 2021-01-17 at 13 07 36

Remove "arrow up" char on the Details component

Pokeapi serves data just as it is scraped from the Nintendo Pokemon ROMs. Thus sometimes it contains some hidden strange characters which were used as a hack to separate text.

Specifically, in the details pane, you are rendering the flavor text for a specific Pokemon. These almost always contain that char. Browsers render it as an arrow pointing up.

meganium

You can use this code to get rid of this annoyance:

        # Page breaks are treated just like newlines.
        # Soft hyphens followed by newlines vanish.
        # Letter-hyphen-newline becomes letter-hyphen, to preserve real
        # hyphenation.
        # Any other newline becomes a space.
        html = flavor_text.replace(u'\f',       u'\n') \
                          .replace(u'\u00ad\n', u'') \
                          .replace(u'\u00ad',   u'') \
                          .replace(u' -\n',     u' - ') \
                          .replace(u'-\n',      u'-') \
                          .replace(u'\n',       u' ')

Reference:

veekun/pokedex#321
veekun/pokedex#218

Increase Expiration of Cached Images

Currently, the service worker is only caching image responses from Github for 5 minutes. Preferably, we would like to cache these for a much longer period (at least a month).

Screenshot 2021-01-17 at 13 20 48

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.