![]() ![]() If a thenable is passed, the returned promise will adopt the state of that thenable by calling the then method and passing a pair of resolving functions as arguments.If a non- thenable value is passed, the returned promise is already fulfilled with that value.The bulk of the resolving logic is actually implemented by the resolver function passed by the Promise() constructor. Otherwise, Promise.resolve() is essentially a shorthand for new Promise((resolve) => resolve(value)). If value belongs to Promise or a subclass, and nstructor = Promise, then value is directly returned by Promise.resolve(), without creating a new Promise instance. Promise.resolve() special-cases native Promise instances. To do so, the subclass's constructor must implement the same signature as the Promise() constructor - accepting a single executor function that can be called with the resolve and reject callbacks as parameters. Promise.resolve() is generic and supports subclassing, which means it can be called on subclasses of Promise, and the result will be a promise of the subclass type. In brief, Promise.resolve() returns a promise whose eventual state depends on another promise, thenable object, or other value. See Promise description for definitions of the terminology. Promise.resolve() resolves a promise, which is not the same as fulfilling or rejecting the promise. Object.prototype._lookupSetter_() Deprecated.Object.prototype._lookupGetter_() Deprecated.Object.prototype._defineSetter_() Deprecated.Object.prototype._defineGetter_() Deprecated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |