سلام خدا قوت... در مورد promisification وقتی که میخواهیم بیش از یک تابع را promisify کنیم توضیح میدهید؟ همینطور منظور از ... در loadScriptPromise و args... چیست؟
return function (...args) { // return a wrapper-function (*)
return new Promise((resolve, reject) => {
function callback(err, result) { // our custom callback for f (**)
if (err) {
reject(err);
} else {
resolve(result);
}
}
args.push(callback); // append our custom callback to the end of f arguments
f.call(this, ...args); // call the original function
});
};
}
// usage:
let loadScriptPromise = promisify(loadScript);
loadScriptPromise(...).then(...);