diff --git a/nodejs-packages/sprotty-live-beans-client/index.html b/nodejs-packages/sprotty-live-beans-client/index.html index 7c171caa7..f47553772 100644 --- a/nodejs-packages/sprotty-live-beans-client/index.html +++ b/nodejs-packages/sprotty-live-beans-client/index.html @@ -11,7 +11,7 @@
-
+

sprotty Circles Example

diff --git a/nodejs-packages/sprotty-live-beans-client/src/app.ts b/nodejs-packages/sprotty-live-beans-client/src/app.ts index b8a149a73..6291f2452 100644 --- a/nodejs-packages/sprotty-live-beans-client/src/app.ts +++ b/nodejs-packages/sprotty-live-beans-client/src/app.ts @@ -21,9 +21,7 @@ import runStandalone from "./standalone"; const appDiv = document.getElementById('sprotty-app') if(appDiv) { - const appMode = appDiv.getAttribute('data-app'); - if (appMode === 'circlegraph') - runStandalone(); - else - throw new Error('Dunno what to do :-('); + const clientId = appDiv.getAttribute('client-id'); + console.log('app.ts : ' + clientId); + runStandalone(clientId || 'spring-boot'); } diff --git a/nodejs-packages/sprotty-live-beans-client/src/model.ts b/nodejs-packages/sprotty-live-beans-client/src/model.ts index 0a26dae59..248ba543b 100644 --- a/nodejs-packages/sprotty-live-beans-client/src/model.ts +++ b/nodejs-packages/sprotty-live-beans-client/src/model.ts @@ -39,7 +39,7 @@ export class VSCodeWebViewDiagramServer extends DiagramServer { listen(vscode: any): void { - window.addEventListener('message', event => { + window.addEventListener('message', (event: any) => { const message = event.data; // The json data that the extension sent console.log('Message Received'); this.messageReceived(message); diff --git a/nodejs-packages/sprotty-live-beans-client/src/standalone.ts b/nodejs-packages/sprotty-live-beans-client/src/standalone.ts index a7c38da59..e87162d67 100644 --- a/nodejs-packages/sprotty-live-beans-client/src/standalone.ts +++ b/nodejs-packages/sprotty-live-beans-client/src/standalone.ts @@ -14,18 +14,19 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ + declare const acquireVsCodeApi: any; import { TYPES, IActionDispatcher, SModelElementSchema, SEdgeSchema, SNodeSchema, SGraphSchema, ModelSource, LocalModelSource, WebSocketDiagramServer, RequestModelAction } from "sprotty"; -import createContainer from "./di.config"; +import createContainer, {TransportMedium} from "./di.config"; import * as SockJS from "sockjs-client"; import {VSCodeWebViewDiagramServer} from "./model"; -export default function runStandalone() { - const container = createContainer(true); +export default function runStandalone(clientId: string) { + const container = createContainer(TransportMedium.LSP, clientId); const dispatcher = container.get(TYPES.IActionDispatcher); // Initialize gmodel @@ -105,6 +106,7 @@ export default function runStandalone() { } if (modelSource instanceof VSCodeWebViewDiagramServer) { + console.log('Listen and acquire VSCode API with client-id = ' + clientId); modelSource.listen(acquireVsCodeApi()); }