install method

void install(
  1. JavascriptRuntime runtime, {
  2. bool resolveEntry = false,
})

Register every module of the bundle in runtime's current context without running it. Call once per context (after a reset, register again).

With resolveEntry the entry's imports are linked immediately, which surfaces a missing or mismatched module before any code runs.

Implementation

void install(JavascriptRuntime runtime, {bool resolveEntry = false}) {
  final entryBytecode = modules[entry];
  if (entryBytecode == null) {
    throw ArgumentError.value(entry, 'entry', 'entry module is missing');
  }
  modules.forEach((name, bytecode) {
    if (name == entry) return;
    runtime.registerModuleBytecode(bytecode);
  });
  runtime.registerModuleBytecode(entryBytecode, resolve: resolveEntry);
}