microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fb6c0d0507b286c72b88078fd6d7bc0ff2fa682d

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/platformResolver.ts

35lines · modepreview

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

import {IRunOptions} from "./launchArgs";
import * as IOSPlatform from "./ios/iOSPlatform";
import * as AndroidPlatform from "./android/androidPlatform";

/**
 * Contains all the mobile platform specific debugging operations.
 */
export interface IAppPlatform {
    runApp(runOptions: IRunOptions): Q.Promise<void>;
    enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void>;
}

export class PlatformResolver {

    /**
     * Resolves the mobile application target platform.
     */
    public resolveMobilePlatform(mobilePlatformString: string): IAppPlatform {
        switch (mobilePlatformString) {
            // We lazyly load the strategies, because some components might be
            // missing on some platforms (like XCode in Windows)
            case "ios":
                let ios: typeof IOSPlatform = require("./ios/iOSPlatform");
                return new ios.IOSPlatform();
            case "android":
                let android: typeof AndroidPlatform = require("./android/androidPlatform");
                return new android.AndroidPlatform();
            default:
                return null;
        }
    }
}