Skip to content

GroundWorks beta ​

Class of @v12-engine/client

ts
export declare class GroundWorks

Where an app's ground textures made in code are made and kept (ClientRuntime.ground): in its worker where it has one (the client's patterns; serveGroundTextures in its file), here otherwise, and kept for the app's life, the oldest let go past about 48 MB. Given what makes the worker (() => new Worker(…)), the worker is made when the first texture is asked of it: a page's menu fetches none of it (OF2)

Members ​

constructor ​

ts
constructor(worker?: GroundWorkerLike | (() => GroundWorkerLike) | null);

Constructs a new instance of the GroundWorks class

bytes ​

ts
get bytes(): number;

How many bytes the textures kept take

clear ​

ts
clear(): void;

Lets every texture kept go, and every file

count ​

ts
get count(): number;

How many textures are kept: for the stats and the tests

dispose ​

ts
dispose(): void;

Lets go of the textures and the worker: what it was asked and did not answer is made here, as without one, and not kept

pixels ​

ts
pixels(pattern: string | PatternDef | PatternMaker, color: Readonly<Rgb>, seed: number, size?: number, recipe?: GroundRecipe, patterns?: Readonly<Record<string, PatternDef>>): Promise<Uint8Array>;

A ground's texture made in code: kept, made in the worker (the client's patterns, where there is one) or made here. Not to be changed: it is kept for whoever asks next

pixelsNow ​

ts
pixelsNow(pattern: string | PatternDef | PatternMaker, color: Readonly<Rgb>, seed: number, size?: number, recipe?: GroundRecipe, patterns?: Readonly<Record<string, PatternDef>>): Uint8Array | undefined;

A ground's texture made in code, as it is kept or made at once: the pixels, or nothing where it is being made in the worker (then pixels says when it is). Without a worker it is always made at once. Not to be changed: it is kept for whoever asks next