Delegate interface that provides document persistence and webview access capabilities.
Implements the delegate pattern to allow the document model to interact with the webview for content retrieval and panel management without tight coupling.
const delegate: NotebookDocumentDelegate = { async getFileData() { // Retrieve current notebook content from webview const notebook = await webview.getNotebookContent(); return new TextEncoder().encode(JSON.stringify(notebook)); }, getWebviewPanel() { return currentWebviewPanel; }}; Copy
const delegate: NotebookDocumentDelegate = { async getFileData() { // Retrieve current notebook content from webview const notebook = await webview.getNotebookContent(); return new TextEncoder().encode(JSON.stringify(notebook)); }, getWebviewPanel() { return currentWebviewPanel; }};
Optional
Optional method to access the associated webview panel. Used for webview lifecycle management and communication.
The webview panel instance or undefined if not available
Retrieves current notebook content from the webview in binary format. Used during save operations to get the latest notebook state.
Binary representation of the current notebook content
Delegate interface that provides document persistence and webview access capabilities.
Implements the delegate pattern to allow the document model to interact with the webview for content retrieval and panel management without tight coupling.
Example