393e434479
This CL unifies the custom events by creating classes specialised based on the event type. Multiple entry selection causes panels to emit 'showentries' event. Single entry selection causes panels to emit 'showentrydetail' event. The events are received by the controller App class and updates the view of the panels and state of the app. Bug: v8:10644 Change-Id: Ibe26223459ba605c6d6d3f0025bf3a556dfb0578 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335188 Commit-Queue: Zeynep Cankara <zcankara@google.com> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#69286}
37 lines
1.0 KiB
JavaScript
37 lines
1.0 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 {SelectEvent} 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 SelectEvent(this.selectedMap.filePosition));
|
|
}
|
|
});
|