Skip to content

Latest commit

 

History

History
463 lines (245 loc) · 9.83 KB

StaticLifetime.md

File metadata and controls

463 lines (245 loc) · 9.83 KB

quickjs-emscriptenquickjs-emscriptenReadme | Exports


quickjs-emscripten / quickjs-emscripten / StaticLifetime

Class: StaticLifetime<T, Owner>

A Lifetime that lives forever. Used for constants.

Contents

Extends

Type parameters

T

Owner = never

Constructors

new StaticLifetime(value, owner)

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

Parameters

value: T

owner?: Owner

Returns

StaticLifetime<T, Owner>

Overrides

quickjs-emscripten.Lifetime.constructor

Source

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

Properties

_alive

protected _alive: boolean = true

Inherited from

quickjs-emscripten.Lifetime._alive

Source

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


_constructorStack

protected _constructorStack: undefined | string

Inherited from

quickjs-emscripten.Lifetime._constructorStack

Source

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


_owner?

protected readonly _owner?: Owner

Inherited from

quickjs-emscripten.Lifetime._owner

Source

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


_value

protected readonly _value: T

Inherited from

quickjs-emscripten.Lifetime._value

Source

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


copier?

protected readonly copier?: (value) => T

Parameters

value: T

Returns

T

Inherited from

quickjs-emscripten.Lifetime.copier

Source

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


disposer?

protected readonly disposer?: (value) => void

Parameters

value: T

Returns

void

Inherited from

quickjs-emscripten.Lifetime.disposer

Source

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

Accessors

alive

get alive(): boolean

Returns

boolean

true if the object is alive

false after the object has been disposed

Source

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


dupable

get dupable(): boolean

Returns

boolean

Source

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


owner

get owner(): undefined | Owner

Returns

undefined | Owner

Source

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


value

get value(): T

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

Source

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

Methods

[dispose]()

[dispose](): void

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

Returns

void

Inherited from

quickjs-emscripten.Lifetime.[dispose]

Source

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


consume()

consume(map)

consume<O>(map): O

Call map with this lifetime, then dispose the lifetime.

Type parameters

O

Parameters

map: (lifetime) => O

Returns

O

the result of map(this).

Inherited from

quickjs-emscripten.Lifetime.consume

Source

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

consume(map)

consume<O>(map): O

Type parameters

O

Parameters

map: (lifetime) => O

Returns

O

Inherited from

quickjs-emscripten.Lifetime.consume

Source

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


dispose()

dispose(): void

Dispose of value and perform cleanup.

Returns

void

Overrides

quickjs-emscripten.Lifetime.dispose

Source

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


dup()

dup(): StaticLifetime<T, Owner>

Create a new handle pointing to the same value.

Returns

StaticLifetime<T, Owner>

Overrides

quickjs-emscripten.Lifetime.dup

Source

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


map()

map(map)

map<O>(map): O

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

Type parameters

O

Parameters

map: (lifetime) => O

Returns

O

the result of map(this).

Inherited from

quickjs-emscripten.Lifetime.map

Source

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

map(map)

map<O>(map): O

Type parameters

O

Parameters

map: (lifetime) => O

Returns

O

Inherited from

quickjs-emscripten.Lifetime.map

Source

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


tap()

tap(fn)

tap(fn): StaticLifetime<T, Owner>

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

StaticLifetime<T, Owner>

this

Inherited from

quickjs-emscripten.Lifetime.tap

Source

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

tap(fn)

tap(fn): QuickJSHandle

Parameters

fn: (lifetime) => void

Returns

QuickJSHandle

Inherited from

quickjs-emscripten.Lifetime.tap

Source

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


Generated using typedoc-plugin-markdown and TypeDoc