v8/tools/system-analyzer/app-model.mjs
Zeynep Cankara 71e0331137 [tools][system-analyzer] Convert App to MVC Pattern
This CL aims to clean the code in App Class to
handle State, View according to the Model-View-Controller
design pattern.

Bug: v8:10644, v8:10735

Link: https://docs.google.com/presentation/d/1ssCIWKS5TIp_PHZRUx2BfElEz6JFrYzz_Ce1h1g8ZBg/edit?usp=sharing

Change-Id: Ie36d437df0df574f505a4396b26526a82215f237
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2324247
Commit-Queue: Zeynep Cankara <zcankara@google.com>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69218}
2020-08-04 09:30:02 +00:00

69 lines
1.6 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.
class State {
#timeSelection = {start: 0, end: Infinity};
#map;
#ic;
#nofChunks;
#chunks;
#icTimeline;
#mapTimeline;
get mapTimeline(){
return this.#mapTimeline;
}
set mapTimeline(value){
this.#mapTimeline = value;
}
set icTimeline(value){
this.#icTimeline = value;
}
get icTimeline(){
return this.#icTimeline;
}
set chunks(value){
//TODO(zcankara) split up between maps and ics, and every timeline track
this.#chunks = value;
}
get chunks(){
//TODO(zcankara) split up between maps and ics, and every timeline track
return this.#chunks;
}
get nofChunks() {
return this.#nofChunks;
}
set nofChunks(count) {
this.#nofChunks = count;
}
get map() {
//TODO(zcankara) rename as selectedMapEvents, array of selected events
return this.#map;
}
set map(value) {
//TODO(zcankara) rename as selectedMapEvents, array of selected events
if(!value) return;
this.#map = value;
}
get ic() {
//TODO(zcankara) rename selectedICEvents, array of selected events
return this.#ic;
}
set ic(value) {
//TODO(zcankara) rename selectedIcEvents, array of selected events
if(!value) return;
this.#ic = value;
}
get timeSelection() {
return this.#timeSelection;
}
get entries() {
if (!this.map) return {};
return {
map: this.map.id, time: this.map.time
}
}
}
export { State };