Skip to content

Instantly share code, notes, and snippets.

View loogle18's full-sized avatar
🏠
Working from home

loogle18 loogle18

🏠
Working from home
View GitHub Profile
@loogle18
loogle18 / cloudSettings
Last active March 16, 2020 17:49
VS Code Settings Sync
{"lastUpload":"2020-03-16T17:49:42.323Z","extensionVersion":"v3.4.3"}
const promisify = function(fn) {
return (...args) => {
return new Promise((resolve, reject) => {
fn(...args, function(err, result) {
if (err) {
reject(new Error(err));
} else {
resolve(result);
}
});
const Pool = function(size) {
this.taskQueue = [];
this.workerQueue = [];
this.poolSize = size;
};
Pool.prototype.addWorkerTask = function(workerTask) {
if (this.workerQueue.length > 0) {
let workerThread = this.workerQueue.shift();