public static Promise all(IIterable promises) { if (promises == null) { return(new Promise(fromException(new JSException(new TypeError("Invalid argruments for Promise.all(...)"))))); } return(new Promise(whenAll(promises.AsEnumerable().Select(convertToTask).ToArray()).ContinueWith(x => new Array(x.Result as IEnumerable) as JSValue))); }
public static Promise race(IIterable promises) { if (promises == null) { return(new Promise(fromException(new JSException(new TypeError("Invalid argruments for Promise.race(...)"))))); } return(new Promise(whenAny(promises.AsEnumerable().Select(convertToTask).ToArray()).ContinueWith(x => x.Result.Result))); }
public Set(IIterable iterable) : this() { if (iterable == null) { return; } foreach (var value in iterable.AsEnumerable()) { _storage.Add(value.Value); } }
/// <summary> /// Copy ctor /// </summary> public List(IIterable <T> source) { var colSource = source as Java.Util.ICollection <T>; if (colSource != null) { list = new ArrayList <T>(colSource); } else { list = new ArrayList <T>(); foreach (var item in source.AsEnumerable()) { list.Add(item); } } }
public Map(IIterable iterable) : this() { if (iterable == null) { return; } foreach (var item in iterable.AsEnumerable()) { if (item._valueType < JSValueType.Object) { ExceptionHelper.ThrowTypeError($"Iterator value {item} is not an entry object"); } var value = item["1"]; _storage[item["0"].Value] = value.Value as JSValue ?? value; } }