Class PromiseLibrary
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.library.Library
com.oracle.truffle.js.api.PromiseLibrary
- All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface, Cloneable
public abstract class PromiseLibrary
extends com.oracle.truffle.api.library.Library
Promise library provides operations on and information about JavaScript
Promise objects.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.Node.Child, com.oracle.truffle.api.nodes.Node.Children -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.oracle.truffle.api.library.LibraryFactory<PromiseLibrary> Returns the library factory for the promise library.Returns the state of thepromise.static PromiseLibraryReturns the uncached automatically dispatched version of the promise library.booleanReturnstrueif theobjectis JavaScriptPromise, returnsfalseotherwise.voidmarkHandled(Object promise) Marks thepromiseas handled (to avoid warnings/errors from its potential unhandled rejection).Methods inherited from class com.oracle.truffle.api.library.Library
acceptsMethods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplace, toString
-
Constructor Details
-
PromiseLibrary
public PromiseLibrary()
-
-
Method Details
-
getFactory
Returns the library factory for the promise library. -
getUncached
Returns the uncached automatically dispatched version of the promise library. -
isPromise
Returnstrueif theobjectis JavaScriptPromise, returnsfalseotherwise. -
getState
public PromiseLibrary.State getState(Object promise) throws com.oracle.truffle.api.interop.UnsupportedMessageException Returns the state of thepromise. ThrowsUnsupportedMessageExceptionwhen the receiver is notisPromise(Object).- Throws:
com.oracle.truffle.api.interop.UnsupportedMessageException
-
markHandled
public void markHandled(Object promise) throws com.oracle.truffle.api.interop.UnsupportedMessageException Marks thepromiseas handled (to avoid warnings/errors from its potential unhandled rejection). It should be invoked before the promise is rejected. ThrowsUnsupportedMessageExceptionwhen the receiver is notisPromise(Object).- Throws:
com.oracle.truffle.api.interop.UnsupportedMessageException
-