initial commit

This commit is contained in:
2022-08-14 13:27:41 -07:00
commit b30e8bcea1
38 changed files with 6919 additions and 0 deletions

24
src/lib/queue.js Normal file
View File

@ -0,0 +1,24 @@
export default function() {
return {
items: [],
resolvers: []
put(item) {
this.items.push(item);
if (resolvers.length > 0) {
resolvers.shift().resolve();
}
},
async get() {
if (this.items.length === 0) {
await new Promise((resolve, reject) => {
this.resolvers.push(resolve);
})
}
return this.items.shift();
},
}
}