What is the specific term for the callback that you pass to the javascript Promise constructor?

StackOverflow https://stackoverflow.com/questions/21563140

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?

有帮助吗?

解决方案

The ECMAScript 6 Language Specification calls it an executor. See section 24.4.3.1.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top