# new Promise()
Trusted Promise constructor. A Promise created from this constructor is a trusted when.js promise. Any other duck-typed promise is considered untrusted.
方法
# always(onFulfilledOrRejectedopt, nullable, onProgressopt, nullable)
Register a callback that will be called when a promise is fulfilled or rejected. Optionally also register a progress handler. Shortcut for .then(onFulfilledOrRejected, onFulfilledOrRejected, onProgress)
参数:
名称 | 类型 | 描述 |
---|---|---|
onFulfilledOrRejected |
function | |
onProgress |
function |
# otherwise(onRejectednullable)
Register a rejection handler. Shortcut for .then(undefined, onRejected)
参数:
名称 | 类型 | 描述 |
---|---|---|
onRejected |
function |
# spread(onFulfilled)
Assumes that this promise will fulfill with an array, and arranges for the onFulfilled to be called with the array as its argument list i.e. onFulfilled.spread(undefined, array).
参数:
名称 | 类型 | 描述 |
---|---|---|
onFulfilled |
function | function to receive spread arguments |