Class BaseWrapper¶
- class BaseWrapper(module, ptr)¶
abstract
- Arguments:
module (AniraWasmInstance)
ptr (PossiblePointer)
- BaseWrapper.ptr¶
type: number
- BaseWrapper.wasmInstance¶
type: AniraWasmInstance
- _destroy(func)¶
- Arguments:
func ((ptr: number) => void)
- destroy()¶
Free the underlying C++ object. See Lifecycle and Cleanup for when to call this.
- getPointer()¶
- Returns:
number
- wrapPointer<T>(Cls, ptr)¶
Wrap a raw WASM pointer as an instance of a wrapper class, reusing this instance’s wasmInstance.
- Type parameters:
T – (extends BaseWrapper)
- Arguments:
Cls ({new (wasmInstance: AniraWasmInstance, args: any[]) => T})
ptr (number)
- Returns:
T
- static createFromPointer<T>(this, module, ptr)¶
- Type parameters:
T – (extends BaseWrapper)
- Arguments:
this ({new (module: AniraWasmInstance, ptr: number) => T})
module (AniraWasmInstance)
ptr (number)
- Returns:
T