@geometryzen/eigenmathts
v0.9.46
Published
Eigenmath in TypeScript with EcmaScript modules
Downloads
31
Readme
eigenmathts
Eigenmath in TypeScript with EcmaScript modules
eigenmathts
is a Javascript program for evaluating Eigenmath scripts in a browser.
Scripts are read from document.getElementById("stdin").value
Results are written to document.getElementById("stdout").innerHTML
For a STEMCstudio example (click here to try)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<base href="/">
<title></title>
<!-- link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/modern-css-reset/dist/reset.min.css" /-->
<link rel="stylesheet" href="style.css">
</head>
<body>
<textarea id="stdin" rows="24" cols="80" style="font-family:courier;font-size:1em" spellcheck="false"></textarea>
<button id="btn-run">Run</button><br>
<div id="stdout"></div>
</body>
</html>
import { run } from '@geometryzen/eigenmathts'
const stdin = document.getElementById("stdin") as HTMLTextAreaElement
stdin.value = [
`f=sin(x)/x`,
`f`,
`yrange=(-1,1)`,
`draw(f,x)`
].join('\n').trim()
const btnRun = document.getElementById("btn-run") as HTMLElement
btnRun.onclick = run
window.onunload = function() {
// Write your application cleanup code here.
}
// Used to ensure that this file is treated as a module.
export { }