I've added a new view in vscode while making an extension.
I want to run a function everytime when this view is opened.
Is there any vscode method to run a function everytime this view is opened or when user come on this view.
I've added a new view in vscode while making an extension.
I want to run a function everytime when this view is opened.
Is there any vscode method to run a function everytime this view is opened or when user come on this view.
Copyright © 2021 Jogjafile Inc.
If your view is a
TreeView
, you can listen to its visibility:event
will have the values{visible: true}
or{visible: false}
depending on whether it was opened or not. It also works for when the view is hidden or unhidden from the Activity Bar or Panel or Secondary Bar - depending on where the user moves it.If your view is a
Webview
you can use the same.onDidChangeVisibility
listener.These do not fire if the View clicked on/revealed is not yours.