npm.io
0.3.12 • Published 2 months ago

@agoric/import-manager

Licence
Apache-2.0
Version
0.3.12
Deps
0
Size
14 kB
Vulns
0
Weekly
1.9K
Stars
355

Import Manager

ImportManager allows a package to make some code available that can be run locally by a calling vat without requiring a remote round trip to the hosting vat. Remote code can indicate what function to run using a key.

Long term, we may want to import from a well-known repository, and manage version upgrades, but for now, we just import the code from the file system.

A package that wanted to export some code for clients to run in their own vat would import or define some functions, then call

  const mgr = importManager();
  return mgr.addExports(
    {
       'usefulFn', export1,
       'helpfulFn', export2,
     });

then it could pass strings like 'usefulFn' to clients, who could import the manager above, then call

const genericFn = importer.lookupImport(name);

Keywords