Files
react-native-devtools-frontend/front_end/panels/css_overview/CSSOverviewController.ts
T
Sigurd Schneider b9f6c7910e Move TargetManager to its own file
Change-Id: I4708a6303198bc5c4ff6aa8e2b2a2f5e4530725f
Bug: chromium:1213943
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2919763
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-05-31 11:24:26 +00:00

38 lines
1.3 KiB
TypeScript

// 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.
/* eslint-disable rulesdir/no_underscored_properties */
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);
}
_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'),
};