v8/tools/system-analyzer/events.mjs
Camillo Bruni 4029804155 [tools] Make sure system analyzer works in FF and Safari
- Avoid private fields (using _xyz instead of #xyz)
- Avoid static fields on classes

These are temporary changes that eventually will be reverted
once FireFox and Safari support it.

Bug: v8:10644
Change-Id: I3d757251eaedef92751970d866882c3d912c7e3e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2464924
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70607}
2020-10-19 11:57:28 +00:00

48 lines
1.3 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 SelectionEvent extends CustomEvent {
// TODO: turn into static class fields once Safari supports it.
static get name() { return "showentries"; }
constructor(entries) {
super(SelectionEvent.name, { bubbles: true, composed: true });
if (!Array.isArray(entries) || entries.length == 0) {
throw new Error("No valid entries selected!");
}
this.entries = entries;
}
}
class FocusEvent extends CustomEvent {
static get name() { return "showentrydetail"; }
constructor(entry) {
super(FocusEvent.name, { bubbles: true, composed: true });
this.entry = entry;
}
}
class SelectTimeEvent extends CustomEvent {
static get name() { return 'timerangeselect'; }
constructor(start, end) {
super(SelectTimeEvent.name, { bubbles: true, composed: true });
this.start = start;
this.end = end;
}
}
class SynchronizeSelectionEvent extends CustomEvent {
static get name() { return 'syncselection'; }
constructor(start, end) {
super(SynchronizeSelectionEvent.name, { bubbles: true, composed: true });
this.start = start;
this.end = end;
}
}
export {
SelectionEvent, FocusEvent, SelectTimeEvent,
SynchronizeSelectionEvent
};