-
Notifications
You must be signed in to change notification settings - Fork 0
/
StaticCode.fs
31 lines (26 loc) · 1.01 KB
/
StaticCode.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module StaticCode
let pyodideAndTurfLoader =
$"""
let cr = interactive.configureRequire({{
paths: {{
pyodide: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide",
turfpath: "https://unpkg.com/@turf/turf@6/turf.min"
}}
}});
cr(["pyodide", "turfpath"], function (pyodide, turf) {{
loadPyodide().then(pyodide => {{
window.pyodide = pyodide;
window.python = pyodide.runPython;
window.pythonAsync = pyodide.runPythonAsync;
//import math here
pyodide.runPython("import math");
console.log("pyscript is running, here goes the proof: " + pyodide.runPython("1 + 3"));
}});
window.turf = turf;
var from = turf.point([-75.343, 39.984]);
var to = turf.point([-75.534, 39.123]);
var options = {{units: 'kilometers'}};
var distance = turf.distance(from, to, options);
console.log("Proof turfjs works:" + distance);
}});
"""