Guest User

Untitled

a guest
May 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. const cache = {}
  2.  
  3. export default getJSONWithCache(url) {
  4. return cache[url] ?
  5. Promise.resolve(cache[url]) :
  6. getJSON(url).then(json => {
  7. cache[url] = json
  8. return json
  9. })
  10. }
Add Comment
Please, Sign In to add comment