Skip to content

Commit 36881c9

Browse files
try adding discrete frontendPlugin
1 parent 1a57af9 commit 36881c9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

kernel/src/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,27 @@ import { EmbeddedKernel } from './kernel';
55
import WelcomePanel from './panel';
66
import { ServiceContainer } from './services/ServiceContainer';
77
import { DeviceService } from './services/DeviceService';
8+
import { JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlite/application';
9+
import { INotebookTracker } from '@jupyterlite/notebook';
810

911
// Variable for saving the DeviceService instance so we can restore it if kernel is restarted
1012
var devService: DeviceService | null = null;
1113

14+
let notebookTracker: INotebookTracker | null = null;
15+
16+
// Frontend plugin to capture the notebook tracker
17+
const frontendPlugin: JupyterFrontEndPlugin<void> = {
18+
id: 'jupyterlite-embedded-kernel:frontend',
19+
autoStart: true,
20+
requires: [INotebookTracker],
21+
activate: (app: JupyterFrontEnd, tracker: INotebookTracker) => {
22+
notebookTracker = tracker;
23+
console.log('Embedded Kernel Frontend Plugin Activated');
24+
25+
console.log('Notebook Tracker:', notebookTracker);
26+
}
27+
};
28+
1229
// Kernel plugin for the embedded kernel
1330
const kernelPlugin: JupyterLiteServerPlugin<void> = {
1431
id: 'jupyterlite-embedded-kernel:kernel',
@@ -77,3 +94,4 @@ const kernelPlugin: JupyterLiteServerPlugin<void> = {
7794
};
7895

7996
export default [kernelPlugin];
97+
export {frontendPlugin, notebookTracker};

0 commit comments

Comments
 (0)