-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
363 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
# JavaScript API | ||
|
||
## `pyjs` | ||
The main module for the JavaScript API. | ||
### `exec` | ||
Execute a string of Python code. | ||
### `exec_eval` | ||
Execute a string of Python code and return the last expression. | ||
|
||
Example: | ||
```javascript | ||
pyjs.exec(` | ||
import numpy | ||
print(numpy.random.rand(3)) | ||
`); | ||
``` | ||
|
||
### `eval` | ||
Evaluate a string with a Python expression. | ||
### `async_exec_eval` | ||
Schedule the execution of a string of Python code and return a promise. | ||
The last expression is returned as the result of the promise. | ||
### `eval_file` | ||
Evaluate a file with Python code. | ||
### `pyobject` | ||
A Python object exported as a JavaScript class | ||
#### `py_call` | ||
Call the `__call__` method of a Python object. | ||
#### `py_apply` | ||
Call the `__call__` method of a Python object with an array of arguments. | ||
#### `get` | ||
Get an attribute of a Python object. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.