[tools][system-analyzer] Create an app class

This CL attaches global functions of the panels
as instance variables of an app class.

Bug: v8:10667, v8:10644

Change-Id: Ib76730652f977ac81e3558ddb18165e938859512
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2297476
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68867}
This commit is contained in:
Zeynep Cankara 2020-07-15 08:28:00 +01:00 committed by Commit Bot
parent 52ce077470
commit 32234d0251
2 changed files with 14 additions and 10 deletions

View File

@ -53,25 +53,22 @@ dd {
}
</style>
<script type="module" >
import {globalSearchBarEvent, globalDataUpload, showMaps, handleSelectIcEvents} from './index.mjs';
//TODO(zcankara): Build an App component that has these methods, rather than using globals
globalThis.globalDataUpload = globalDataUpload;
globalThis.globalSearchBarEvent = globalSearchBarEvent;
globalThis.showMaps = showMaps;
globalThis.handleSelectIcEvents = handleSelectIcEvents;
import {App} from './index.mjs';
globalThis.app = new App();
</script>
</head>
<body>
<div id="content">
<section id="file-reader">
<br></br>
<log-file-reader id="log-file-reader" onchange="globalDataUpload(event)"></log-file-reader>
<log-file-reader id="log-file-reader" onchange="app.globalDataUpload(event)"></log-file-reader>
<br></br>
</section>
<div id="container" style="display: none;">
<timeline-panel id="timeline-panel"></timeline-panel>
<map-panel id="map-panel" onclick="globalSearchBarEvent(event)" onchange="showMaps(event)"></map-panel>
<ic-panel id="ic-panel" onchange="handleSelectIcEvents(event)"></ic-panel>
<map-panel id="map-panel" onclick="app.globalSearchBarEvent(event)" onchange="showMaps(event)"></map-panel>
<ic-panel id="ic-panel" onchange="app.handleSelectIcEvents(event)"></ic-panel>
</div>
</div>

View File

@ -114,4 +114,11 @@ function handleSelectIcEvents(e){
document.state.filteredEntries = e.detail;
}
export {globalSearchBarEvent, globalDataUpload, showMaps, handleSelectIcEvents};
class App {
globalDataUpload = globalDataUpload;
globalSearchBarEvent = globalSearchBarEvent;
showMaps = showMaps;
handleSelectIcEvents = handleSelectIcEvents;
}
export {App};