by gloosx · 1y ago · 0 comments
const PromiseQueue = {
queue: Promise.resolve(true),
sendOnce(request) {
return new Promise((resolve, reject) => {
this.queue = this.queue
.then(request)
.then(resolve)
.catch(reject)
})
}
}Are you sure? I'm not a javascript programmer and it took less than 2 minutes to comprehend. If you think this takes considerable effort to comprehend then I don't think you actually tried.
While this works, it's not exactly intuitive.