Skip to content

AsyncArray

Core and matricesclassOpenCV 5.0.0
import { AsyncArray } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSAsyncArray
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

Returns result of asynchronous operations

Object has attached asynchronous state. Assignment operator doesn't clone asynchronous state (it is shared between all instances).

Result can be fetched via get() method only once.

Constructors and members

static new

Create an owned AsyncArray object. Release native handles with using or delete().

new(): AsyncArray;
Returns

The AsyncArray result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

release

Release this asynchronous result reference and its associated storage.

release(): void;

get

Fetch the result.

Note: Result or stored exception can be fetched only once.

get(dst: Mat): void;
dst

Output destination, filled by the native operation. destination array

Waits for result until container has valid result. Throws exception if exception was stored as a result.

Throws exception on invalid container state.

get1

Retrieving the result with timeout

Note: Result or stored exception can be fetched only once.

get1(dst: Mat, timeoutNs: number): boolean;
dst

Output destination, filled by the native operation. destination array

timeoutNs

timeout in nanoseconds, -1 for infinite wait

Returns

true if result is ready, false if the timeout has expired

wait_for

Wait up to the supplied timeout for the result and return whether it became ready. Native asynchronous execution backends are not enabled in this build.

wait_for(timeoutNs: number): boolean;
timeoutNs

timeout ns argument (number).

Returns

The boolean result.

valid

Return whether this object holds an asynchronous result state.

valid(): boolean;
Returns

The boolean result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.