v8/tools/system-analyzer/map-panel/map-details.mjs
Zeynep Cankara 34b652607a [tools][system-analyzer] Change naming conventions
This CL establishes a naming consistency
across the app by renaming classes.

Class Name Changes:
SelectEvent -> FocusEvent
Entry -> IcLogEvent
V8Map -> MapLogEvent

Bug: v8:10644
Change-Id: Id075d9aa36ac6f03af0224feb0e38985b1445013
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2349300
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69382}
2020-08-13 13:39:44 +00:00

42 lines
1.2 KiB
JavaScript

// Copyright 2020 the V8 project 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 { V8CustomElement, defineCustomElement } from "../helper.mjs";
import { FocusEvent } from "../events.mjs";
defineCustomElement(
"./map-panel/map-details",
(templateText) =>
class MapDetails extends V8CustomElement {
constructor() {
super(templateText);
this.mapDetails.addEventListener("click", () =>
this.handleClickSourcePositions()
);
this.selectedMap = undefined;
}
get mapDetails() {
return this.$("#mapDetails");
}
setSelectedMap(value) {
this.selectedMap = value;
}
set mapDetails(map) {
let details = "";
if (map) {
details += "ID: " + map.id;
details += "\nSource location: " + map.filePosition;
details += "\n" + map.description;
this.setSelectedMap(map);
}
this.mapDetails.innerText = details;
}
handleClickSourcePositions() {
this.dispatchEvent(new FocusEvent(this.selectedMap.filePosition));
}
}
);