mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-13 01:54:52 +08:00
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>
38 lines
1.3 KiB
TypeScript
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'),
|
|
};
|