| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| import './main.css'; |
| import { LoggingView } from './components/view'; |
| import { State } from './src/state'; |
| |
| //@ts-check |
| |
| // This script will be run within the webview itself |
| // It cannot access the main VS Code APIs directly. |
| (function () { |
| const view = new LoggingView(new State(acquireVsCodeApi()), document.body); |
| |
| // Handle messages sent from the extension to the webview |
| window.addEventListener('message', event => { |
| const message = event.data; |
| switch (message.type) { |
| case 'addLog': |
| view.addLog(message.log); |
| break; |
| case 'reset': |
| view.reset(); |
| } |
| }); |
| }()); |