QuickBEAM.VM.Runtime (QuickBEAM v0.10.9)

Copy Markdown View Source

Shared helpers for the BEAM JS runtime: coercion, callbacks, object creation.

Summary

Functions

Calls a JavaScript callback using the active invocation context.

Invokes a global constructor and returns fallback.() when it is unavailable.

Invokes a global constructor and updates the constructed object map before returning it.

Returns the active interpreter gas budget or the default budget outside evaluation.

Returns the current runtime global binding map, building and caching it when needed.

Returns the class prototype associated with a globally registered constructor.

Looks up a globally registered constructor by JavaScript name.

Creates an empty JavaScript object value.

Normalizes a possibly-negative index against a sequence length.

Sorts JavaScript array-index-like keys before ordinary string keys.

Returns strict BEAM equality for places that need identity-style comparison.

Stringifies a VM value using JavaScript conversion rules.

Coerces simple runtime helper inputs to a float-like value.

Coerces simple runtime helper inputs to an integer, defaulting unsupported values to zero.

Coerces a VM value to a JavaScript number-like value.

Returns JavaScript truthiness for a VM value.

Functions

call_callback(fun, args)

Calls a JavaScript callback using the active invocation context.

construct_global(name, args, fallback)

Invokes a global constructor and returns fallback.() when it is unavailable.

construct_global(name, args, fallback, update_object)

Invokes a global constructor and updates the constructed object map before returning it.

gas_budget()

Returns the active interpreter gas budget or the default budget outside evaluation.

global_bindings()

Returns the current runtime global binding map, building and caching it when needed.

global_class_proto(name)

Returns the class prototype associated with a globally registered constructor.

global_constructor(name)

Looks up a globally registered constructor by JavaScript name.

new_object()

Creates an empty JavaScript object value.

normalize_index(idx, len)

Normalizes a possibly-negative index against a sequence length.

sort_numeric_keys(keys)

Sorts JavaScript array-index-like keys before ordinary string keys.

strict_equal?(a, b)

Returns strict BEAM equality for places that need identity-style comparison.

stringify(val)

Stringifies a VM value using JavaScript conversion rules.

to_float(n)

Coerces simple runtime helper inputs to a float-like value.

to_int(n)

Coerces simple runtime helper inputs to an integer, defaulting unsupported values to zero.

to_number(val)

Coerces a VM value to a JavaScript number-like value.

truthy?(val)

Returns JavaScript truthiness for a VM value.