More
JavaScript and WebAssembly
bindings/js packages the engine compiled to WebAssembly for browsers and Node 18 or later. It is the same
Engine::execute_json as every other front end, so the numbers match the CLI exactly (the package’s test checks
that). See ADR-014 for the design.
import { load, EshanaError } from "eshana";
const eshana = await load();
const env = eshana.execute({
op: "chart", system: "vedic",
when: { date: "1990-05-15", time: "14:30", timezone: "Asia/Kolkata" },
place: { latitude: 28.6139, longitude: 77.209 },
config: { zodiac: "sidereal", ayanamsha: "lahiri" },
});
load(source?): in Node the.wasmbeside the module; in a browser it is fetched beside it. Pass a URL, aResponse, bytes or a compiledWebAssembly.Moduleto load it from elsewhere.execute(request)returns the envelope or throwsEshanaError(with.code);executeJson(text)returns JSON text and never throws.- Every operation works with the built-in
analyticprovider (VSOP87, arc-second level). Thespkprovider needs a kernel file, which the module cannot open, so it answersESH-PROVIDER. - The module has no imports: no network, no file system, no clock (give
utcor a local date and zone).
Build it from the repository with make js, which compiles the module, copies it into bindings/js and runs the
parity test against the native CLI.