Packages

class AsyncLocalStorage[T] extends Object with StObject

When having multiple instances of AsyncLocalStorage, they are independent from each other. It is safe to instantiate this class multiple times.

Annotations
@JSType() @JSImport("async_hooks", "AsyncLocalStorage") @native()
Source
asyncHooksMod.scala
Linear Supertypes
StObject, Object, Any, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AsyncLocalStorage
  2. StObject
  3. Object
  4. Any
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new AsyncLocalStorage()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  6. def disable(): Unit

    This method disables the instance of AsyncLocalStorage.

    This method disables the instance of AsyncLocalStorage. All subsequent calls to asyncLocalStorage.getStore() will return undefined until asyncLocalStorage.run() is called again.

    When calling asyncLocalStorage.disable(), all current contexts linked to the instance will be exited.

    Calling asyncLocalStorage.disable() is required before the asyncLocalStorage can be garbage collected. This does not apply to stores provided by the asyncLocalStorage, as those objects are garbage collected along with the corresponding async resources.

    This method is to be used when the asyncLocalStorage is not in use anymore in the current process.

  7. def enterWith(store: T): Unit

    Calling asyncLocalStorage.enterWith(store) will transition into the context for the remainder of the current synchronous execution and will persist through any following asynchronous calls.

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def exit[R](callback: Function1[Any, R], args: Any*): R

    This methods runs a function synchronously outside of a context and return its return value.

    This methods runs a function synchronously outside of a context and return its return value. The store is not accessible within the callback function or the asynchronous operations created within the callback.

    Optionally, arguments can be passed to the function. They will be passed to the callback function.

    If the callback function throws an error, it will be thrown by exit too. The stacktrace will not be impacted by this call and the context will be re-entered.

  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  12. def getStore(): UndefOr[T]

    This method returns the current store.

    This method returns the current store. If this method is called outside of an asynchronous context initialized by calling asyncLocalStorage.run, it will return undefined.

  13. def hasOwnProperty(v: scala.Predef.String): Boolean
    Definition Classes
    Object
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  20. def propertyIsEnumerable(v: scala.Predef.String): Boolean
    Definition Classes
    Object
  21. def run[R](store: T, callback: Function1[Any, R], args: Any*): R

    This methods runs a function synchronously within a context and return its return value.

    This methods runs a function synchronously within a context and return its return value. The store is not accessible outside of the callback function or the asynchronous operations created within the callback.

    Optionally, arguments can be passed to the function. They will be passed to the callback function.

    I the callback function throws an error, it will be thrown by run too. The stacktrace will not be impacted by this call and the context will be exited.

  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toLocaleString(): scala.Predef.String
    Definition Classes
    Object
  24. def toString(): java.lang.String
    Definition Classes
    AnyRef → Any
  25. def valueOf(): Any
    Definition Classes
    Object
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from StObject

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped