Class: StaticLifetime\

February 16, 2026 ยท View on GitHub

quickjs-emscripten


quickjs-emscripten / quickjs-emscripten-core / StaticLifetime

Class: StaticLifetime<T, Owner>

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:197

A Lifetime that lives forever. Used for constants.

Contents

Extends

Type Parameters

T

T

Owner

Owner = never

Constructors

Constructor

new StaticLifetime<T, Owner>(value, owner?): StaticLifetime<T, Owner>

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:198

Parameters

value

T

owner?

Owner

Returns

StaticLifetime<T, Owner>

Overrides

Lifetime.constructor

Properties

_alive

protected _alive: boolean = true

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:72

Inherited from

Lifetime._alive


_constructorStack

protected _constructorStack: string | undefined

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:73

Inherited from

Lifetime._constructorStack


_owner?

protected readonly optional _owner: Owner

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:87

Inherited from

Lifetime._owner


_value

protected readonly _value: T

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:84

Inherited from

Lifetime._value


copier()?

protected readonly optional copier: (value) => T

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:85

Parameters

value

T

Returns

T

Inherited from

Lifetime.copier


disposer()?

protected readonly optional disposer: (value) => void

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:86

Parameters

value

T

Returns

void

Inherited from

Lifetime.disposer

Accessors

alive

Get Signature

get alive(): boolean

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:92

Returns

boolean

true if the object is alive

Inherited from

Lifetime.alive


dupable

Get Signature

get dupable(): boolean

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:203

Returns

boolean

Overrides

Lifetime.dupable


owner

Get Signature

get owner(): Owner | undefined

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:107

Returns

Owner | undefined

Inherited from

Lifetime.owner


value

Get Signature

get value(): T

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:102

The value this Lifetime protects. You must never retain the value - it may become invalid, leading to memory errors.

Throws

If the lifetime has been disposed already.

Returns

T

Inherited from

Lifetime.value

Methods

[dispose]()

[dispose](): void

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:47

Just calls the standard .dispose() method of this class.

Returns

void

Inherited from

Lifetime.[dispose]


assertAlive()

protected assertAlive(): void

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:182

Returns

void

Inherited from

Lifetime.assertAlive


consume()

Call Signature

consume<O>(map): O

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:135

Call map with this lifetime, then dispose the lifetime.

Type Parameters
O

O

Parameters
map

(lifetime) => O

Returns

O

the result of map(this).

Inherited from

Lifetime.consume

Call Signature

consume<O>(map): O

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:138

Call map with this lifetime, then dispose the lifetime.

Type Parameters
O

O

Parameters
map

(lifetime) => O

Returns

O

the result of map(this).

Inherited from

Lifetime.consume


dispose()

dispose(): void

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:213

Dispose of value and perform cleanup.

Returns

void

Overrides

Lifetime.dispose


dup()

dup(): StaticLifetime<T, Owner>

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:208

Create a new handle pointing to the same value.

Returns

StaticLifetime<T, Owner>

Overrides

Lifetime.dup


map()

Call Signature

map<O>(map): O

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:151

Call map with this lifetime, returning the result. Does not dispose the lifetime.

Type Parameters
O

O

Parameters
map

(lifetime) => O

Returns

O

the result of map(this).

Inherited from

Lifetime.map

Call Signature

map<O>(map): O

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:152

Call map with this lifetime, returning the result. Does not dispose the lifetime.

Type Parameters
O

O

Parameters
map

(lifetime) => O

Returns

O

the result of map(this).

Inherited from

Lifetime.map


tap()

Call Signature

tap(fn): this

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:164

Call fn with this lifetime, then return this. Does not dispose the lifetime. Useful for imperative operations within an expression, like when you're building up objects, or to add logging in the middle of a call chain.

Parameters
fn

(lifetime) => void

Returns

this

this

Inherited from

Lifetime.tap

Call Signature

tap(fn): QuickJSHandle

Defined in: packages/quickjs-emscripten-core/src/lifetime.ts:165

Call fn with this lifetime, then return this. Does not dispose the lifetime. Useful for imperative operations within an expression, like when you're building up objects, or to add logging in the middle of a call chain.

Parameters
fn

(lifetime) => void

Returns

QuickJSHandle

this

Inherited from

Lifetime.tap