-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.ts
31 lines (28 loc) · 1.02 KB
/
index.ts
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
import type {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { INotebookTracker } from '@jupyterlab/notebook';
import { NotebookAPI } from './dataAPI/jupyter/notebook';
import { ProfilePanel } from './ProfilePanel';
/**
* Initialization data for the AutoProfiler extension.
*/
const plugin: JupyterFrontEndPlugin<void> = {
id: 'AutoProfiler:plugin',
autoStart: true,
activate: (app: JupyterFrontEnd, notebookTracker: INotebookTracker) => {
const panel: ProfilePanel = new ProfilePanel();
app.shell.add(panel, 'right', { rank: 1000 });
// emitted when the user's notebook changes, null if all notebooks close
notebookTracker.currentChanged.connect((_, widget) => {
const notebook = new NotebookAPI(widget);
notebook.ready.then(async () => {
// connect panel to notebook
await panel.connectNotebook(notebook);
});
});
},
requires: [INotebookTracker]
};
export default plugin;