microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
4cd259621ddfbd348fade892a2f3ee87fd1924c5

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/android/logCatMonitorManager.ts

29lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import { LogCatMonitor } from "./logCatMonitor";
5
6export class LogCatMonitorManager {
7 public static readonly logCatMonitorsCache: { [key: string]: LogCatMonitor } = {};
8
9 public static addMonitor(monitor: LogCatMonitor): void {
10 this.logCatMonitorsCache[monitor.deviceId.toLowerCase()] = monitor;
11 }
12
13 public static getMonitor(deviceId: string): LogCatMonitor {
14 return this.logCatMonitorsCache[deviceId.toLowerCase()];
15 }
16
17 public static delMonitor(deviceId: string): void {
18 if (this.logCatMonitorsCache[deviceId.toLowerCase()]) {
19 this.logCatMonitorsCache[deviceId.toLowerCase()].dispose();
20 delete this.logCatMonitorsCache[deviceId.toLowerCase()];
21 }
22 }
23
24 public static cleanUp(): void {
25 Object.keys(LogCatMonitorManager.logCatMonitorsCache).forEach(monitor => {
26 LogCatMonitorManager.delMonitor(monitor);
27 });
28 }
29}
30