Module registry
Expand description
The applications a multi-app host can mount, registered once per process.
A host that links applications in-process (the browser’s desktop bundle, a shell hosting apps in-process) reads this list instead of naming apps in its own code. Registration is idempotent per app id: the first definition for an id wins, so a bundle that lists an app twice still shows it once.
An application can also be registered deferred: by id and title, with
a function that loads its code and yields its definition. The browser
bundle registers most apps this way, so their code is fetched when one
first opens instead of with the page. Until then the app is listed
(catalogue) but has no definition (application); load starts
the load, and its definition replaces the deferred entry in place.
Functions§
- application
- The registered application with id
app_id, once its definition is loaded. - applications
- Every registered application whose definition is loaded, in registration order.
- catalogue
- Every registered application, loaded or not, as
(id, title)in registration order: what a launcher lists. - defer
- Register an application whose code
loadfetches when it is first needed. Returnsfalsewhen the id is already registered. - is_
deferred - Whether
app_idis registered but its code is not loaded yet. - load
- The definition of
app_id, loading its code first when it is deferred:Nonefor an id nobody registered or code that failed to load (a later call tries again). Concurrent loads of one app share the fetch where the loader does. - register
- Register
definition. Returnsfalsewhen an application with the same id is already registered; that earlier definition stays. A deferred entry for the id is replaced, keeping its place in the list.