microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.7.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/extension/android/logCatMonitorManager.ts

29lines · modepreview

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.

import { LogCatMonitor } from "./logCatMonitor";

export class LogCatMonitorManager {
    public static readonly logCatMonitorsCache: { [key: string]: LogCatMonitor } = {};

    public static addMonitor(monitor: LogCatMonitor): void {
        this.logCatMonitorsCache[monitor.deviceId.toLowerCase()] = monitor;
    }

    public static getMonitor(deviceId: string): LogCatMonitor {
        return this.logCatMonitorsCache[deviceId.toLowerCase()];
    }

    public static delMonitor(deviceId: string): void {
        if (this.logCatMonitorsCache[deviceId.toLowerCase()]) {
            this.logCatMonitorsCache[deviceId.toLowerCase()].dispose();
            delete this.logCatMonitorsCache[deviceId.toLowerCase()];
        }
    }

    public static cleanUp(): void {
        Object.keys(LogCatMonitorManager.logCatMonitorsCache).forEach(monitor => {
            LogCatMonitorManager.delMonitor(monitor);
        });
    }
}