Class Registry#

The registry of one scope (globalThis[Symbol.for('anira.registry')]): the processors and engines the scope’s code defined, which the C trampolines of anira/anira_em.h call. Use defineProcessor() and defineEngine(); scopeRegistry() returns it.

class Registry()#

The registry of one scope, globalThis[Symbol.for('anira.registry')]: the processors and engines the scope’s code defined, keyed by keyOf(name), and the instances built over the scope’s module. The C trampolines of anira/anira_em.h call processor, engine and log with the module of the instance that runs the call; an inference Worker awaits boot before its loop.

defineProcessor(name, factory)#
Arguments:
  • name (string)

  • factory (ProcessorFactory)

Returns:

number

defineEngine(id, factory)#
Arguments:
  • id (string)

  • factory (EngineFactory)

Returns:

number

async boot(module)#

Bind the scope to its module instance and build and initialise every engine defined so far: what an inference Worker awaits before it enters its loop.

Arguments:
  • module (AbiModule)

Returns:

Promise<void>

processor(module, key, phase, a, b)#

The processor trampoline’s target.

Arguments:
  • module (AbiModule)

  • key (number)

  • phase (number)

  • a (number)

  • b (number)

Returns:

number

engine(module, key, phase, a, b, idPtr)#

The engine trampoline’s target.

Arguments:
  • module (AbiModule)

  • key (number)

  • phase (number)

  • a (number)

  • b (number)

  • idPtr (number)

Returns:

number

log(module, record)#

The log hook’s target.

Arguments:
  • module (AbiModule)

  • record (number)

Registry.logSink#

type: null | (record: LogRecord) => void

The scope’s log sink (anira_em_set_log_hook); none: the records are not shown here.

envOf(module)#

The env of this scope’s module instance; the first call binds the scope to module.

Arguments:
  • module (AbiModule)

Returns:

ScopeEnv