Skip to main content
Module

x/structurae/index.ts>ViewConstructor

Data structures for high-performance JavaScript applications.
Latest
interface ViewConstructor
import { type ViewConstructor } from "https://deno.land/x/structurae@4.0.1/index.ts";

Type Parameters

T
optional
Instance = ViewInstance<T>

Properties

viewLength: number

The byte length of the view.

optional
itemLength: number

The byte length of an item inside the container view.

optional
layout: ViewLayout<T>
optional
defaultData: Uint8Array
optional
ObjectConstructor: Constructor<T>
optional
View: unknown

Methods

new(...args: any[]): Instance
decode(
view: DataView,
start?: number,
length?: number,
): T

Decodes a given view into corresponding JavaScript value.

encode(
value: T,
view: DataView,
start?: number,
length?: number,
): number

Encodes a JavaScript value into a given view.

from(value: T): Instance

Creates a view from a given JavaScript value.

getLength(size?: number | unknown): number

Returns the length of the view.

initialize(...args: Array<unknown>): UnknownViewConstructor

Intializes a view class, used for complex and container views.