Skip to main content
Version: 0.10.0

Type Alias: ResourceScope

ResourceScope = object

Defined in: core/lifetime.ts:26

A set of native resources with a single teardown.

Properties​

dispose()​

readonly dispose: () => void

Defined in: core/lifetime.ts:40

Releases every tracked resource, most recently allocated first. Safe to call more than once: a second call has nothing left to release.

Returns​

void


track()​

readonly track: <R>(resource) => R

Defined in: core/lifetime.ts:34

Takes ownership of a resource and returns it unchanged, so it can wrap an allocation in place.

Type Parameters​

R​

R extends NativeResource

The concrete NativeResource type being tracked.

Parameters​

resource​

R

The resource to take ownership of.

Returns​

R

The same resource, unchanged.

We are Software Mansion.