About
The @esfx
suite of packages is designed to provide low-level interoperability between 3rd-party packages for a number of common operations.
The suite is broken down into the following categories:
- Low-level API Packages
- Collection Classes
- Async Coordination Primitives
- Thread Synchronization Primitives
- Decorators
- Utilities
- Shims
- Adapters
Low-level API Packages
The primary purpose of @esfx
is to provide a number of low-level Symbol
-based API packages to allow interop between 3rd-party packages:
-
@esfx/equatable
- A low-levelSymbol
-based API for defining equality and comparability. -
@esfx/collection-core
- A low-levelSymbol
-based API for defining common collection behaviors. -
@esfx/disposable
- A low-levelSymbol
-based API for defining explicit resource management. -
@esfx/cancelable
- A low-levelSymbol
-based API for defining a common cancellation protocol. -
@esfx/async-lockable
- A low-levelSymbol
-based API that represents a value that can be used to coordinate access to a resource asynchronously. -
@esfx/threading-lockable
- A low-levelSymbol
-based API that represents a value that can be used to synchronize access to a resource synchronously.
Collection Classes
The following packages provide reusable collection and list abstractions over the @esfx/collection-core
and @esfx/equatable
packages:
-
@esfx/collections
- A common collections API composed of the following packages: -
@esfx/collections-hashmap
- AMap
implementation that supports key-equality via the Equatable interface from@esfx/equatable
. -
@esfx/collections-hashset
- ASet
implementation that supports key-equality via the Equatable interface from@esfx/equatable
. -
@esfx/collections-linkedlist
- A linked-list implementation. -
@esfx/collections-sortedmap
- AMap
implementation that supports key-equality via the Comparable interface from@esfx/equatable
. -
@esfx/collections-sortedset
- ASet
implementation that supports key-equality via the Comparable interface from@esfx/equatable
.
Async Coordination Primitives
The following packages provide primitives to help coordinate async operations:
-
@esfx/async
- A composite package consisting of the following component packages: -
@esfx/async-autoresetevent
- Represents a synchronization event that, when signaled, resets automatically after releasing a single waiting asynchronous operation. -
@esfx/async-barrier
- A class that enables multiple tasks to cooperatively work on an algorithm through multiple phases. -
@esfx/async-canceltoken
- An object used to signal requests for cancellation. -
@esfx/async-conditionvariable
- An async coordination primitive that synchronizes access to a shared variable and controls notification to waiting operations. -
@esfx/async-countdown
- An event becomes signaled when all participants have become signaled. -
@esfx/async-deferred
- Encapsulates aPromise
and exposes its resolve and reject callbacks. -
@esfx/async-delay
- A function that waits the specified number of milliseconds before resolving. -
@esfx/async-lazy
- A class that provides a lazy-initialized asynchronous value. -
@esfx/async-manualresetevent
- Represents a synchronization event that, when signaled, releases all waiting asynchronous operations. -
@esfx/async-mutex
- An async coordination primitive used to coordinate access to a protected resource. -
@esfx/async-queue
- An asynchronous FIFO queue. -
@esfx/async-readerwriterlock
- Coordinates readers and writers for a resource. -
@esfx/async-semaphore
- Limits the number of asynchronous operations that can access a pool of resources. -
@esfx/async-stack
- An asynchronous LIFO stack. -
@esfx/async-waitqueue
- An async coordination primitive that provides a queue ofPromise
objects that can be used to schedule resolution.
Thread Synchronization Primitives
The following packages provide primitives to help synchronize and coordinate multiple threads using Workers:
-
@esfx/threading
- A composite package consisting of the following component packages: -
@esfx/threading-autoresetevent
- Represents a synchronization event that, when signaled, resets automatically after releasing a single waiting thread. -
@esfx/threading-conditionvariable
- A thread synchronization primitive that synchronizes access to a shared variable and controls notification to waiting operations. -
@esfx/threading-countdown
- An event becomes signaled when all participants have become signaled. -
@esfx/threading-manualresetevent
- Represents a synchronization event that, when signaled, releases all waiting threads. -
@esfx/threading-mutex
- A thread synchronization primitive used to synchronize access to a protected resource. -
@esfx/threading-semaphore
- Limits the number of threads that can access a pool of resources. -
@esfx/threading-sleep
- A function that blocks the current thread for the specified number of milliseconds. -
@esfx/threading-spinwait
- Provides support for spin-based waiting.
Decorators
The following packages provide decorators and decorator-related functionality:
-
@esfx/decorators-stage1-core
- Provides a low-level API for working with ECMAScript Stage-1 decorators. -
@esfx/decorators
- Provides a number of frequently used decorators.
Utilities
The following packages provide various utilities:
-
@esfx/events
- A low-level API for defining events. -
@esfx/indexed-object
- A base class for custom integer-indexed objects. -
@esfx/lazy
- Provides a class to simplify lazy-initialization logic. -
@esfx/metadata
- An API for defining metadata about an object. -
@esfx/ref
- A low-level API for defining forward references. -
@esfx/struct-type
- Defines structured types backed by `ArrayBuffer` or `SharedArrayBuffer` instances that can be easily serialized or shared across Workers. -
@esfx/type-model
- A number of useful types for TypeScript.
Shims
Shim packages augment built-in objects with functionality from the main packages.
-
@esfx/cancelable-dom-shim
- A shim that adds the@esfx/cancelable
API to the DOMAbortSignal
andAbortController
. -
@esfx/collection-core-shim
- A shim that adds the@esfx/collection-core
API to ECMAScript native global objects. -
@esfx/collection-core-dom-shim
- A shim that adds the@esfx/collection-core
API to DOM global objects. -
@esfx/equatable-shim
- A shim that adds the@esfx/equatable
API to ECMAScript native global objects. -
@esfx/metadata-shim
- A shim that adds minimal@esfx/metadata
functionality to the ECMAScriptReflect
global object for use with TypeScript's-emitDecoratorMetadata
option. -
@esfx/reflect-metadata-compat
- Areflect-metadata
-compatible shim for the@esfx/metadata
package.
Adapters
Adapter packages provide functionality to simplify interoperability scenarios with different platforms:
-
@esfx/cancelable-dom
- Provides an adapter function to convert aCancelable
into a DOMAbortSignal
.
License
esfx
is distributed as open source under the Apache License 2.0.