blob: f1039ea0dc3669270b1a53d37ae9d21a3c1b198c [file] [log] [blame]
// Copyright 2019 The Chromium 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 * as Common from '../../core/common/common.js';
import * as SDK from '../../core/sdk/sdk.js';
export class OverviewController extends Common.ObjectWrapper.ObjectWrapper {
currentUrl: string;
constructor() {
super();
this.currentUrl = SDK.TargetManager.TargetManager.instance().inspectedURL();
SDK.TargetManager.TargetManager.instance().addEventListener(
SDK.TargetManager.Events.InspectedURLChanged, this.checkUrlAndResetIfChanged, this);
}
private checkUrlAndResetIfChanged(): void {
if (this.currentUrl === SDK.TargetManager.TargetManager.instance().inspectedURL()) {
return;
}
this.currentUrl = SDK.TargetManager.TargetManager.instance().inspectedURL();
this.dispatchEventToListeners(Events.Reset);
}
}
export const Events = {
RequestOverviewStart: Symbol('RequestOverviewStart'),
RequestNodeHighlight: Symbol('RequestNodeHighlight'),
PopulateNodes: Symbol('PopulateNodes'),
RequestOverviewCancel: Symbol('RequestOverviewCancel'),
OverviewCompleted: Symbol('OverviewCompleted'),
Reset: Symbol('Reset'),
};