loadSpacecraftfunction
Load the fitted paths of some spacecraft (or all of them), each a table of its own that nothing else imports: about 6 kB gzipped for the Voyagers, the Pioneers, New Horizons and JWST, and more for the craft that orbited a planet. Call it once before the other functions; it is safe to call again.
Import it
import { loadSpacecraft } from "@johnmorrisdotca/wakusei-planets/spacecraft";
Definition
function loadSpacecraft(...ids: readonly SpacecraftId[]): Promise<void>
Parameters
| Name | Type | Description |
|---|---|---|
...ids | readonly ("voyager1" | "voyager2" | "newhorizons" | "pioneer10" | "pioneer11" | "cassini" | "galileo" | "juno" | "parker" | "webb")[] | The craft to load; none means all ten. |
Returns
Promise<void>
A promise that settles when every table is registered.
Examples
import { loadSpacecraft, spacecraftPosition } from "@johnmorrisdotca/wakusei-planets/spacecraft";
await loadSpacecraft("voyager1");
const [x, y, z] = spacecraftPosition("voyager1", Date.UTC(2026, 10, 8));
console.log((Math.hypot(x, y, z) / 149597870.7).toFixed(0), "au from the Sun");172 au from the SunWhat it prints (run when this page was built)