Skip to Content
Bear documentation

init

Import from bear/manifold/init.

Type Aliases

Handle

type Handle = Manifold | CrossSection;

Defined in: bear/manifold/init.ts:34

WASM memory that is only freed by delete().

Functions

detached()

function detached<T>(fn): T;

Defined in: bear/manifold/init.ts:77

Run fn owned by no materialize: what it makes along the way is freed (also when it throws), and the handle it returns is the caller's to delete.

Type Parameters

Type Parameter
T extends Handle

Parameters

ParameterType
fn() => T

Returns

T


dropEntry()

function dropEntry(entry): void;

Defined in: bear/manifold/init.ts:109

Free a cache entry the cache is dropping, once it has loaded.

Parameters

ParameterType
entryPromise<Handle | null>

Returns

void


initManifold()

function initManifold(): Promise<ManifoldToplevel>;

Defined in: bear/manifold/init.ts:15

Eagerly load the Manifold WASM module. Returns the cached instance on subsequent calls. Routed through manifold-3d's own loader so its global (used by helpers like gltfDocToManifold) and our cached handle are the same instance. Concurrent first callers share one load, so the module is hooked once.

Returns

Promise<ManifoldToplevel>


manifoldModule()

function manifoldModule(): ManifoldToplevel;

Defined in: bear/manifold/init.ts:28

The loaded Manifold module, synchronously. render() awaits initManifold() before collecting, so parts computing extents with CrossSection math can rely on it.

Returns

ManifoldToplevel


owning()

function owning<T>(owned, fn): T;

Defined in: bear/manifold/init.ts:50

Run fn, adding every handle it creates to owned.

Type Parameters

Type Parameter
T

Parameters

ParameterType
ownedSet<Handle>
fn() => T

Returns

T


release()

function release(handles): void;

Defined in: bear/manifold/init.ts:89

Free every handle in handles that is still live, and forget them.

Parameters

ParameterType
handlesSet<Handle>

Returns

void


scoped()

function scoped<T>(fn): T;

Defined in: bear/manifold/init.ts:64

Run fn owning every handle it makes and free them all when it returns: for code outside materialize that uses solids and returns plain data.

Type Parameters

Type Parameter
T

Parameters

ParameterType
fn() => T

Returns

T


share()

function share<T>(handle): T;

Defined in: bear/manifold/init.ts:102

A cache owns its entries and hands out shares: another handle on the same solid (embind refcounts it), owned by the caller like any handle it makes.

Type Parameters

Type Parameter
T extends object

Parameters

ParameterType
handleT

Returns

T

On this page