Skip to content

API ​

haywire-launcher is ESM only, with haywire and entry-script as peer dependencies.

launch(container, id?, options?) ​

ParamTypeDefaultDescription
containerContainer—Required. A Haywire container that can provide id.
idHaywireId or classEntryScriptThe id, or class, to get from the container. Its type must implement entry-script's Main.
options.disposebooleanfalseDispose the container once main() resolves or rejects, or when getting the id fails. If disposing fails after main() rejected, rejects with a SuppressedError of both, as await using does.

Returns a WrapperMain: an EntryScript subclass, to export as the module's default. The container isn't used until it runs.

Static methodDescription
main(argv)Gets the id from the container with getAsync(), and calls its main(argv). Called by entry-script when the module is the entry point.
getOriginal()Gets the id from the container, without calling main.

A container that can't provide id, or an id whose type doesn't implement Main, is a type error.