Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions java/elemental2/promise/AllSettledResultElement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2026 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
*/
package elemental2.promise;
Comment thread
niloc132 marked this conversation as resolved.

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;

/**
* Represents an element of the array returned by Promise.allSettled().
* @param <VALUE> the type of the succeeded promise.
*/
@JsType(isNative = true, name = "Promise.AllSettledResultElement", namespace = JsPackage.GLOBAL)
@NullMarked
public interface AllSettledResultElement<VALUE extends @Nullable Object> {
@JsProperty
String getStatus();

@JsProperty
@Nullable
VALUE getValue();

@JsProperty
@Nullable
Object getReason();
}
10 changes: 10 additions & 0 deletions java/elemental2/promise/Promise.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public interface ResolveValueUnionType<V extends @Nullable Object> {
private static native <V extends @Nullable Object> Promise<V> raceInternal(
IThenable<? extends V>[] promises);

@JsOverlay
public static <V extends @Nullable Object> Promise<AllSettledResultElement<V>[]> allSettled(
IThenable<? extends V>... promises) {
return allSettledInternal(promises);
}

@JsMethod(name = "allSettled")
private static native <V extends @Nullable Object> Promise<AllSettledResultElement<V>[]> allSettledInternal(
IThenable<? extends V>[] promises);

public static native <V extends @Nullable Object> Promise<V> reject(@Nullable Object error);

@JsOverlay
Expand Down
3 changes: 2 additions & 1 deletion java/elemental2/promise/promise.types
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
IThenable=elemental2.promise.IThenable
Promise=elemental2.promise.Promise
Promise=elemental2.promise.Promise
AllSettledResultElement=elemental2.promise.AllSettledResultElement