evazion / translate-pixiv-tags

MIT License
35 stars 6 forks source link

Memoize getJSON call so it's called only once per unique parameters #14

Closed BrokenEagle closed 5 years ago

BrokenEagle commented 5 years ago

Since a caching mechanism is being used, there should only need to be one call to the getJSON function for each unique set of parameters. Subsequent calls will await on the promise returned by the first call.

Also, the get function does not need to be an asynchronous function since the outer function is using await. This avoids the promise getting unwrapped, re-wrapped, then unwrapped again.

Timelines