ES6 Promise 将回调作为参数:
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"));
}
});
这些callback-you-pass-to-create-a-promise是否有术语?