microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
readme-sync-master-command-behaviors

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/android/logCatMonitorManager.ts

29lines · modeblame

8df5011eYuri Skorokhodov5 years ago1// 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 {
7public static readonly logCatMonitorsCache: { [key: string]: LogCatMonitor } = {};
8
9public static addMonitor(monitor: LogCatMonitor): void {
10this.logCatMonitorsCache[monitor.deviceId.toLowerCase()] = monitor;
11}
12
13public static getMonitor(deviceId: string): LogCatMonitor {
14return this.logCatMonitorsCache[deviceId.toLowerCase()];
15}
16
17public static delMonitor(deviceId: string): void {
18if (this.logCatMonitorsCache[deviceId.toLowerCase()]) {
19this.logCatMonitorsCache[deviceId.toLowerCase()].dispose();
20delete this.logCatMonitorsCache[deviceId.toLowerCase()];
21}
22}
23
24public static cleanUp(): void {
25Object.keys(LogCatMonitorManager.logCatMonitorsCache).forEach(monitor => {
26LogCatMonitorManager.delMonitor(monitor);
27});
28}
29}