mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
R=aerotwist@chromium.org Bug: 1187573 Change-Id: I0b397dfa7ea26083fe0d773fb5c8f33a8b34e330 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831985 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
// Copyright 2020 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 Root from '../../core/root/root.js';
|
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
|
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
import type * as Sources from '../../panels/sources/sources.js';
|
|
|
|
const UIStrings = {
|
|
/**
|
|
*@description Title of the 'Node' tool in the Network Navigator View, which is part of the Sources tool
|
|
*/
|
|
node: 'Node',
|
|
/**
|
|
*@description Command for showing the 'Node' tool in the Network Navigator View, which is part of the Sources tool
|
|
*/
|
|
showNode: 'Node',
|
|
};
|
|
|
|
const str_ = i18n.i18n.registerUIStrings('entrypoints/node_app/node_app-meta.ts', UIStrings);
|
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
|
|
let loadedSourcesModule: (typeof Sources|undefined);
|
|
|
|
async function loadHelpModule(): Promise<typeof Sources> {
|
|
if (!loadedSourcesModule) {
|
|
// Side-effect import resources in module.json
|
|
await Root.Runtime.Runtime.instance().loadModulePromise('sources');
|
|
loadedSourcesModule = await import('../../panels/sources/sources.js');
|
|
}
|
|
return loadedSourcesModule;
|
|
}
|
|
|
|
UI.ViewManager.registerViewExtension({
|
|
location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW,
|
|
id: 'navigator-network',
|
|
title: i18nLazyString(UIStrings.node),
|
|
commandPrompt: i18nLazyString(UIStrings.showNode),
|
|
order: 2,
|
|
persistence: UI.ViewManager.ViewPersistence.PERMANENT,
|
|
async loadView() {
|
|
const Sources = await loadHelpModule();
|
|
return Sources.SourcesNavigator.NetworkNavigatorView.instance();
|
|
},
|
|
});
|