Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/canvaseno/mod.ts>MallocObj

Canvas API for deno
Latest
interface MallocObj
import { type MallocObj } from "https://deno.land/x/canvaseno@v1.0.2/mod.ts";

This object is a wrapper around a pointer to some memory on the WASM heap. The type of the pointer was determined at creation time.

Properties

readonly
length: number

The number of objects this pointer refers to.

readonly
byteOffset: number

The "pointer" into the WASM memory. Should be fixed over the lifetime of the object.

Methods

subarray(start: number, end: number): TypedArray

Return a read/write view into a subset of the memory. Do not cache the TypedArray this returns, it may be invalidated if the WASM heap is resized. This is the same as calling .toTypedArray().subarray() except the returned TypedArray can also be passed into an API and not cause an additional copy.

toTypedArray(): TypedArray

Return a read/write view of the memory. Do not cache the TypedArray this returns, it may be invalidated if the WASM heap is resized. If this TypedArray is passed into a CanvasKit API, it will not be copied again, only the pointer will be re-used.