mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-10 21:54:47 +08:00
R=aerotwist@chromium.org, jacktfranklin@chromium.org Bug: 1101738 Change-Id: I406acc5e456237fda0d5c6b468f66d6c0b66fbc8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2323621 Commit-Queue: Jan Scheffler <janscheffler@chromium.org> Auto-Submit: Jan Scheffler <janscheffler@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
// 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.
|
|
|
|
// @ts-nocheck
|
|
// TODO(crbug.com/1011811): Enable TypeScript compiler checks
|
|
|
|
import * as Common from '../common/common.js';
|
|
import * as SDK from '../sdk/sdk.js';
|
|
|
|
/**
|
|
* @unrestricted
|
|
*/
|
|
export class OverviewController extends Common.ObjectWrapper.ObjectWrapper {
|
|
constructor() {
|
|
super();
|
|
|
|
this.currentUrl = SDK.SDKModel.TargetManager.instance().inspectedURL();
|
|
SDK.SDKModel.TargetManager.instance().addEventListener(
|
|
SDK.SDKModel.Events.InspectedURLChanged, this._checkUrlAndResetIfChanged, this);
|
|
}
|
|
|
|
_checkUrlAndResetIfChanged() {
|
|
if (this.currentUrl === SDK.SDKModel.TargetManager.instance().inspectedURL()) {
|
|
return;
|
|
}
|
|
|
|
this.currentUrl = SDK.SDKModel.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'),
|
|
};
|