Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@daschi daschi commented Oct 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment