The ECMAScript 6 Language Specification calls it an executor. See section 24.4.3.1.
What is the specific term for the callback that you pass to the javascript Promise constructor?
-
07-10-2022 - |
题
The ES6 Promise takes a callback as argument:
var promise = new Promise(function(resolve, reject) {
// do a thing, possibly async, then…
if (/* everything turned out fine */) {
resolve("Stuff worked!");
}
else {
reject(Error("It broke"));
}
});
Is there a term for these callback-you-pass-to-create-a-promise's?
解决方案
其他提示
They are usually referred to as "targets".
I would just call them "callbacks"
But if you want to be specific then success and error callbacks.
不隶属于 StackOverflow