我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The PromiseResolver
interface represents an object controlling the state and the result value of a Promise
.
Properties
No specific property.
Methods
Doesn't inherit any method.
PromiseResolver.fulfill()
- Sets the result value of the associated
Promise
to the parameter and its state tofulfill
. Call the fulfill callbacks or, if the asynch parameter is set totrue
, queue a task to call them. PromiseResolver.resolve()
- ...
PromiseResolver.reject()
- Sets the result value of the associated
Promise
to the parameter and its state torejected
. Call the reject callbacks or if the asynch parameter is set totrue
, queue a task to call them.
Specification
Specification | Status | Comment |
---|---|---|
DOM The definition of 'PromiseResolver' in that specification. |
Living Standard | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | No support | 24 (24)[1] | No support | No support | No support |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | No support | 24.0 (24)[1] | No support | No support | No support |
[1] Nightly of Gecko 24 got an experimental implementation of PromiseResolver
, under the initial name of FutureResolver
. It got renamed to its final name in the Gecko 25. To disable it, the preference dom.promise.enabled
(in Gecko 24, dom.future.enabled
) must be switched to false
. Note, only Nightly and Dev Edition versions of Firefox get this interface enabled by default. Beta and Release versions of Gecko have them disabled by default.
See also
- Using DOM promises
- Related DOM interfaces:
Promise