mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-30 01:43:36 +08:00
This CL adds the eslint-plugin-jsdoc plugin and enables just one rule, `jsdoc/check-alignment`, which ensures that all the lines in a comment are correctly aligned. For example: ``` /** * foo * bar */ ``` Would fail the check and be corrected to: ``` /** * foo * bar */ ``` DISABLE_THIRD_PARTY_CHECK=deliberate install + use of eslint-plugin-jsdoc node_module Bug: none Change-Id: I969983cd550653654a334ede3409b8c850467245 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4110906 Commit-Queue: Andres Olivares <andoli@chromium.org> Reviewed-by: Andres Olivares <andoli@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
// Copyright 2022 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 i18n from '../../core/i18n/i18n.js';
|
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
import type * as SDK from '../../core/sdk/sdk.js';
|
|
import type * as Platform from '../../core/platform/platform.js';
|
|
|
|
import {ApplicationPanelTreeElement} from './ApplicationPanelTreeElement.js';
|
|
import {type ResourcesPanel} from './ResourcesPanel.js';
|
|
|
|
import {PreloadingView} from './preloading/PreloadingView.js';
|
|
|
|
const UIStrings = {
|
|
/**
|
|
*@description Text in Application Panel Sidebar of the Application panel
|
|
*/
|
|
prefetchingAndPrerendering: 'Prefetching & Prerendering',
|
|
};
|
|
const str_ = i18n.i18n.registerUIStrings('panels/application/ApplicationPanelPreloadingSection.ts', UIStrings);
|
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
|
export class PreloadingTreeElement extends ApplicationPanelTreeElement {
|
|
private model?: SDK.PrerenderingModel.PrerenderingModel;
|
|
private view?: PreloadingView;
|
|
|
|
constructor(resourcesPanel: ResourcesPanel) {
|
|
super(resourcesPanel, i18nString(UIStrings.prefetchingAndPrerendering), false);
|
|
|
|
const icon = UI.Icon.Icon.create('mediumicon-fetch', 'resource-tree-item');
|
|
this.setLeadingIcons([icon]);
|
|
|
|
// TODO(https://crbug.com/1384419): Set link
|
|
}
|
|
|
|
get itemURL(): Platform.DevToolsPath.UrlString {
|
|
return 'preloading://' as Platform.DevToolsPath.UrlString;
|
|
}
|
|
|
|
initialize(model: SDK.PrerenderingModel.PrerenderingModel): void {
|
|
this.model = model;
|
|
}
|
|
|
|
onselect(selectedByUser?: boolean): boolean {
|
|
super.onselect(selectedByUser);
|
|
|
|
if (!this.model) {
|
|
return false;
|
|
}
|
|
|
|
if (!this.view) {
|
|
this.view = new PreloadingView(this.model);
|
|
}
|
|
|
|
this.showView(this.view);
|
|
// TODO(https://crbug.com/1384419): Report metrics when the panel shown.
|
|
|
|
return false;
|
|
}
|
|
}
|