mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-06 20:11:38 +08:00
To suppress the races, we mark these invocations with `void` per the instructions of `no-floating-promises`. This explicitly marks these statements as side-effect promises. Engineers can later analyze these void statements and determine whether the promise races are intentional or accidental. R=jacktfranklin@chromium.org Bug: 1239617 Change-Id: I6b7a24cf21029d6ff73b112b3e8255ebab8c60ec Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3366467 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org> Auto-Submit: Tim Van der Lippe <tvanderlippe@chromium.org>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
// Copyright 2018 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 '../shell/shell.js';
|
|
import '../../panels/js_profiler/js_profiler-meta.js';
|
|
|
|
import * as Common from '../../core/common/common.js';
|
|
import * as Host from '../../core/host/host.js';
|
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
import * as Main from '../main/main.js';
|
|
|
|
const UIStrings = {
|
|
/**
|
|
*@description Text that refers to the main target.
|
|
*/
|
|
main: 'Main',
|
|
};
|
|
|
|
const str_ = i18n.i18n.registerUIStrings('entrypoints/js_app/js_app.ts', UIStrings);
|
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
|
let jsMainImplInstance: JsMainImpl;
|
|
|
|
export class JsMainImpl implements Common.Runnable.Runnable {
|
|
static instance(opts: {forceNew: boolean|null} = {forceNew: null}): JsMainImpl {
|
|
const {forceNew} = opts;
|
|
if (!jsMainImplInstance || forceNew) {
|
|
jsMainImplInstance = new JsMainImpl();
|
|
}
|
|
|
|
return jsMainImplInstance;
|
|
}
|
|
|
|
async run(): Promise<void> {
|
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirectly);
|
|
void SDK.Connections.initMainConnection(async () => {
|
|
const target = SDK.TargetManager.TargetManager.instance().createTarget(
|
|
'main', i18nString(UIStrings.main), SDK.Target.Type.Node, null);
|
|
void target.runtimeAgent().invoke_runIfWaitingForDebugger();
|
|
}, Components.TargetDetachedDialog.TargetDetachedDialog.webSocketConnectionLost);
|
|
}
|
|
}
|
|
|
|
Common.Runnable.registerEarlyInitializationRunnable(JsMainImpl.instance);
|
|
new Main.MainImpl.MainImpl();
|