Skip to content

Commit a6cab6d

Browse files
authored
Merge pull request jupyter-ai-contrib#24 from jtpio/document-dev-tools-usage
Document executing commands from the dev tools console
2 parents 9d6eb7d + 2e9e821 commit a6cab6d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ app.commands.execute('jupyterlab-diff:unified-file-diff', {
7676
});
7777
```
7878

79+
### Browser console via `window.jupyterapp`
80+
81+
The commands can also be run from the browser console (for example during development) via the `app` object exposed as `window.jupyterapp`. The commands can be executed exactly the same way using `window.jupyterapp.commands.execute(...)`.
82+
83+
First JupyterLab needs to be started with the `--expose-app-in-browser` flag to expose `window.jupyterapp`:
84+
85+
```
86+
jupyter lab --expose-app-in-browser
87+
```
88+
89+
Then, in the browser dev tools console:
90+
91+
```javascript
92+
window.jupyterapp.commands.execute('jupyterlab-diff:split-cell-diff', {
93+
originalSource: `def add():\n return\n`,
94+
newSource: `def add(a, b):\n return a + b\n`,
95+
showActionButtons: true
96+
});
97+
```
98+
7999
### Command Arguments
80100

81101
#### `jupyterlab-diff:split-cell-diff` (Split View)

0 commit comments

Comments
 (0)