public class Promise extends SimpleScriptable
Promise
.Constructor and Description |
---|
Promise()
Default constructor.
|
Promise(Object object)
Constructor new promise with the given
object . |
Promise(Window window)
Facility constructor.
|
Modifier and Type | Method and Description |
---|---|
static Promise |
all(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
Returns a
Promise that resolves when all of the promises in the iterable argument have resolved,
or rejects with the reason of the first passed promise that rejects. |
Promise |
catch_js(Object onRejected)
Returns a Promise and deals with rejected cases only.
|
String |
getLogDetails() |
static Promise |
race(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
Returns a
Promise that that resolves or rejects as soon as one of the promises
in the iterable resolves or rejects, with the value or reason from that promise. |
static Promise |
reject(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
Returns a
Promise object that is rejected with the given value. |
static Promise |
resolve(net.sourceforge.htmlunit.corejs.javascript.Context context,
net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
Object[] args,
net.sourceforge.htmlunit.corejs.javascript.Function function)
Returns a
Promise object that is resolved with the given value. |
Promise |
then(Object onFulfilled,
Object onRejected)
It takes two arguments, both are callback functions for the success and failure cases of the Promise.
|
clone, equivalentValues, get, getBrowserVersion, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
defineFunctionProperties, defineProperty, getClassName, put, setClassName, setParentScope
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
public Promise()
public Promise(Window window)
window
- the owning windowpublic Promise(Object object)
object
.object
- the objectpublic static Promise resolve(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
Promise
object that is resolved with the given value.context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionPromise
public static Promise reject(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
Promise
object that is rejected with the given value.context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionPromise
public static Promise all(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
Promise
that resolves when all of the promises in the iterable argument have resolved,
or rejects with the reason of the first passed promise that rejects.context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionPromise
public static Promise race(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
Promise
that that resolves or rejects as soon as one of the promises
in the iterable resolves or rejects, with the value or reason from that promise.context
- the contextthisObj
- this objectargs
- the argumentsfunction
- the functionPromise
public Promise then(Object onFulfilled, Object onRejected)
onFulfilled
- success functiononRejected
- failure functionPromise
public Promise catch_js(Object onRejected)
onRejected
- failure functionPromise
public String getLogDetails()
Copyright © 2002–2021 Gargoyle Software Inc.. All rights reserved.