Last active
October 24, 2017 22:01
-
-
Save jaredatron/5a4140d71c7679574da819a781a7589a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const doSomething = (uniqueThing) => { | |
if (doSomething.currentRequest[uniqueThing]) { | |
return doSomething.currentRequest[uniqueThing] | |
} | |
return doSomething.currentRequest[uniqueThing] = require(url, params) | |
.then( | |
response => { | |
delete doSomething.currentRequest | |
return response | |
}, | |
error => { | |
delete doSomething.currentRequest | |
throw error | |
} | |
) | |
} | |
doSomething.cache = {} |
daschi
commented
Oct 24, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment