blob: cb034cfaf2ca146f504de529f7911e68dd136296 [file] [log] [blame]
// 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();
}
});
}());