Skip to content

Commit 22bf599

Browse files
committed
Adding pyodide js interface
1 parent fa2ab61 commit 22bf599

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import 'package:js/js.dart';
2+
3+
// Define the external JavaScript functions we need
4+
@JS('loadPyodide')
5+
external Object loadPyodide(Object config);
6+
7+
@JS()
8+
@anonymous
9+
class PyodideInterface {
10+
external Object runPythonAsync(String code);
11+
external Object runPython(String code);
12+
external Object pyimport(String packageName);
13+
external FileSystem get FS;
14+
external PyodideGlobals get globals;
15+
}
16+
17+
@JS()
18+
@anonymous
19+
class PyodideGlobals {
20+
external Object get(String name);
21+
}
22+
23+
@JS()
24+
@anonymous
25+
class FileSystem {
26+
external Object writeFile(String path, String data, Object options);
27+
}

0 commit comments

Comments
 (0)