Spectrum is now read-only. Learn more about the decision in our official announcement.


Eclipse Theia - Cloud & Desktop IDE


document not defined error

September 25, 2019 at 4:33am

document not defined error

September 25, 2019 at 4:33am
I am getting document not defined error when i am using, document.getElementById
I have included "dom" inside package.json lib.

September 25, 2019 at 4:34am
Hi, in which context?
You can only access DOM in browser context, i.e. from frontend extension entry module. It is not accessible from backend entry points or VS Code extensions (Theia plugins).
I am using in theia plugins frontend context
I am also getting navigator is not defined error
Plugins are never running in the main browser process, either in web worker or in Node.js process. Both don't have access to DOM.
You can use webviews of VS Code extensions to integrate iframe in Theia or create a native Theia extension to have access to the DOM of main window.
May i know how to access plugin from other extensions?
activate method can return an object which is accessible from other VS Code extension with vscode.extensions.getExtension('anotherPlugin').exports
can i have any sample code to see how to use?

September 26, 2019 at 1:09am
Only VS Code extension can access another VS Code extension apis, native Theia extensions don't have access to them.

September 26, 2019 at 11:39am