@@ -5,10 +5,27 @@ import { EmbeddedKernel } from './kernel';
5
5
import WelcomePanel from './panel' ;
6
6
import { ServiceContainer } from './services/ServiceContainer' ;
7
7
import { DeviceService } from './services/DeviceService' ;
8
+ import { JupyterFrontEnd , JupyterFrontEndPlugin } from '@jupyterlite/application' ;
9
+ import { INotebookTracker } from '@jupyterlite/notebook' ;
8
10
9
11
// Variable for saving the DeviceService instance so we can restore it if kernel is restarted
10
12
var devService : DeviceService | null = null ;
11
13
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
+
12
29
// Kernel plugin for the embedded kernel
13
30
const kernelPlugin : JupyterLiteServerPlugin < void > = {
14
31
id : 'jupyterlite-embedded-kernel:kernel' ,
@@ -77,3 +94,4 @@ const kernelPlugin: JupyterLiteServerPlugin<void> = {
77
94
} ;
78
95
79
96
export default [ kernelPlugin ] ;
97
+ export { frontendPlugin , notebookTracker } ;
0 commit comments