diff --git a/src/extension.ts b/src/extension.ts index 463320436..f195fcab4 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -41,7 +41,9 @@ let currentActiveDevice: string = DEFAULT_DEVICE; export let outChannel: vscode.OutputChannel | undefined; function loadScript(context: vscode.ExtensionContext, scriptPath: string) { - return ``; } @@ -1137,7 +1139,7 @@ function getWebviewContent(context: vscode.ExtensionContext) {
- ${loadScript(context, "out/vendor.js")} diff --git a/src/view/App.tsx b/src/view/App.tsx index cff908a5a..3e96b0adf 100644 --- a/src/view/App.tsx +++ b/src/view/App.tsx @@ -28,6 +28,15 @@ class App extends React.Component<{}, IState> { this.state = defaultState; } componentDidMount() { + if (document.currentScript) { + const initialDevice = document.currentScript.getAttribute( + "initialDevice" + ); + + if (initialDevice) { + this.setState({ currentDevice: initialDevice }); + } + } window.addEventListener("message", this.handleMessage); } componentWillUnmount() { diff --git a/src/view/index.tsx b/src/view/index.tsx index 9b0fc44a2..32e7400b1 100644 --- a/src/view/index.tsx +++ b/src/view/index.tsx @@ -14,7 +14,6 @@ const locale = "en"; const message = { en: messageEn, }; - ReactDOM.render(