Files
react-native-devtools-frontend/front_end/css_overview/CSSOverviewController.js
T
Paul Lewis daac106699 [global] Remaps self.SDK.targetManager
This CL changes references to self.SDK.targetManager (the global
instance of SDK.SDKModel.TargetManager) over to
SDK.SDKModel.TargetManager.instance(). To keep both TypeScript and
Closure happy we must make a method on the TargetManager class itself,
since it only allows private constructors to be accessed by static
methods on the class.

Bug: 1058320
Change-Id: I6ca35024c21cf24254fd6273138a1ab3e163ee00
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2088092
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-05 14:58:03 +00:00

38 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.
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'),
};