Extension that is notified while current notebook is saved

Hi,

I have a jupyterlab extension that opens notebooks and automatically runs certain cells.
I want my extension to be notified when the user saves the notebook.
I took a look at notebookTracker but couldn’t figure out how to do it.
Is there a solution to this?

Regards

From notebookTracker.widgetAdded.connect((tracker, widget) => { widget }) you get a widget which is NotebookPanel, and NotebookPanel.context gives you IContext.saveState which you can use like:

widget.context.saveState.connect(yourCallbackOnSaveStatusChange)
2 Likes