Skip to content

Add Promise.allSettled and AllSettledResultElement#183

Open
niloc132 wants to merge 1 commit intogoogle:masterfrom
Vertispan:182-promise-allsettled
Open

Add Promise.allSettled and AllSettledResultElement#183
niloc132 wants to merge 1 commit intogoogle:masterfrom
Vertispan:182-promise-allsettled

Conversation

@niloc132
Copy link
Contributor

Fixes #182

@niloc132
Copy link
Contributor Author

This is a quick sketch of what this likely should look like, based on Promise.all() and race(). Note that the AllSettledResultElement would technically have setters and a create() method, but there is no plausible mechanism for a user to create these elements directly.

Likely there are some specific desired @JsNullable/@Nullable expectations - happy to apply any desired changes.

@@ -0,0 +1,20 @@
package elemental2.promise;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the Copyright header ?

* Represents an element of the array returned by Promise.allSettled().
* @param <VALUE> the type of the succeeded promise.
*/
@JsType(isNative = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jstype(isNative = true, name = "Promise.AllSettledResultElement", namespace = JsPackage.GLOBAL)

* @param <VALUE> the type of the succeeded promise.
*/
@JsType(isNative = true)
public interface AllSettledResultElement<VALUE> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should nullmarked this type:

@NullMarked
public interface AllSettledResultElement<VALUE extends @Nullable Object> 

and value and reason should be nullable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Promise.allSettled

2 participants