quickjs-emscripten • quickjs-emscripten-core • Readme | Exports
quickjs-emscripten / quickjs-emscripten-core / WeakLifetime
A Lifetime that does not own its value
. A WeakLifetime never calls its
disposer
function, but can be dup
ed to produce regular lifetimes that
do.
Used for function arguments.
Lifetime
<T
,TCopy
,Owner
>
• T
• TCopy = never
• Owner = never
new WeakLifetime<
T
,TCopy
,Owner
>(value
,copier
?,disposer
?,owner
?):WeakLifetime
<T
,TCopy
,Owner
>
• value: T
• copier?: (value
) => TCopy
• disposer?: (value
) => void
• owner?: Owner
WeakLifetime
<T
, TCopy
, Owner
>
quickjs-emscripten-core.Lifetime.constructor
packages/quickjs-emscripten-core/src/lifetime.ts:224
protected
_alive:boolean
=true
quickjs-emscripten-core.Lifetime._alive
packages/quickjs-emscripten-core/src/lifetime.ts:72
protected
_constructorStack:undefined
|string
quickjs-emscripten-core.Lifetime._constructorStack
packages/quickjs-emscripten-core/src/lifetime.ts:73
protected
readonly
_owner?:Owner
quickjs-emscripten-core.Lifetime._owner
packages/quickjs-emscripten-core/src/lifetime.ts:87
protected
readonly
_value:T
quickjs-emscripten-core.Lifetime._value
packages/quickjs-emscripten-core/src/lifetime.ts:84
protected
readonly
copier?: (value
) =>TCopy
• value: T
| TCopy
TCopy
quickjs-emscripten-core.Lifetime.copier
packages/quickjs-emscripten-core/src/lifetime.ts:85
protected
readonly
disposer?: (value
) =>void
• value: T
| TCopy
void
quickjs-emscripten-core.Lifetime.disposer
packages/quickjs-emscripten-core/src/lifetime.ts:86
get
alive():boolean
boolean
true if the object is alive
false after the object has been disposed
packages/quickjs-emscripten-core/src/lifetime.ts:92
get
dupable():boolean
boolean
packages/quickjs-emscripten-core/src/lifetime.ts:111
get
owner():undefined
|Owner
undefined
| Owner
packages/quickjs-emscripten-core/src/lifetime.ts:107
get
value():T
The value this Lifetime protects. You must never retain the value - it may become invalid, leading to memory errors.
If the lifetime has been disposed already.
T
packages/quickjs-emscripten-core/src/lifetime.ts:102
[dispose]():
void
Just calls the standard .dispose() method of this class.
void
quickjs-emscripten-core.Lifetime.[dispose]
packages/quickjs-emscripten-core/src/lifetime.ts:47
consume<
O
>(map
):O
Call map
with this lifetime, then dispose the lifetime.
• O
• map: (lifetime
) => O
O
the result of map(this)
.
quickjs-emscripten-core.Lifetime.consume
packages/quickjs-emscripten-core/src/lifetime.ts:135
consume<
O
>(map
):O
• O
• map: (lifetime
) => O
O
quickjs-emscripten-core.Lifetime.consume
packages/quickjs-emscripten-core/src/lifetime.ts:138
dispose():
void
Dispose of value and perform cleanup.
void
quickjs-emscripten-core.Lifetime.dispose
packages/quickjs-emscripten-core/src/lifetime.ts:234
dup():
Lifetime
<TCopy
,TCopy
,Owner
>
Create a new handle pointing to the same value.
Lifetime
<TCopy
, TCopy
, Owner
>
quickjs-emscripten-core.Lifetime.dup
packages/quickjs-emscripten-core/src/lifetime.ts:118
map<
O
>(map
):O
Call map
with this lifetime, returning the result.
Does not dispose the lifetime.
• O
• map: (lifetime
) => O
O
the result of map(this)
.
quickjs-emscripten-core.Lifetime.map
packages/quickjs-emscripten-core/src/lifetime.ts:151
map<
O
>(map
):O
• O
• map: (lifetime
) => O
O
quickjs-emscripten-core.Lifetime.map
packages/quickjs-emscripten-core/src/lifetime.ts:152
tap(
fn
):WeakLifetime
<T
,TCopy
,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.
• fn: (lifetime
) => void
WeakLifetime
<T
, TCopy
, Owner
>
this
quickjs-emscripten-core.Lifetime.tap
packages/quickjs-emscripten-core/src/lifetime.ts:164
tap(
fn
):QuickJSHandle
• fn: (lifetime
) => void
quickjs-emscripten-core.Lifetime.tap
packages/quickjs-emscripten-core/src/lifetime.ts:165
Generated using typedoc-plugin-markdown and TypeDoc