microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/debugger/platformResolver.ts
35lines · modeblame
a31b007cunknown10 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
acf08bc2dlebu10 years ago | 4 | import {IRunOptions} from "../common/launchArgs"; |
bc7a32ceJimmy Thomson10 years ago | 5 | import * as IOSPlatform from "./ios/iOSPlatform"; |
| 6 | import * as AndroidPlatform from "./android/androidPlatform"; | |
fb2bae06Daniel10 years ago | 7 | |
65ee84c9unknown10 years ago | 8 | /** |
| 9 | * Contains all the mobile platform specific debugging operations. | |
| 10 | */ | |
f8d32439dlebu10 years ago | 11 | export interface IAppPlatform { |
fb2bae06Daniel10 years ago | 12 | runApp(runOptions: IRunOptions): Q.Promise<void>; |
e639e7a4Daniel10 years ago | 13 | enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void>; |
65ee84c9unknown10 years ago | 14 | } |
| 15 | | |
f5ea0577unknown10 years ago | 16 | export class PlatformResolver { |
65ee84c9unknown10 years ago | 17 | |
f5ea0577unknown10 years ago | 18 | /** |
| 19 | * Resolves the mobile application target platform. | |
| 20 | */ | |
f8d32439dlebu10 years ago | 21 | public resolveMobilePlatform(mobilePlatformString: string): IAppPlatform { |
f5ea0577unknown10 years ago | 22 | switch (mobilePlatformString) { |
| 23 | // We lazyly load the strategies, because some components might be | |
| 24 | // missing on some platforms (like XCode in Windows) | |
| 25 | case "ios": | |
bc7a32ceJimmy Thomson10 years ago | 26 | let ios: typeof IOSPlatform = require("./ios/iOSPlatform"); |
f8d32439dlebu10 years ago | 27 | return new ios.IOSPlatform(); |
f5ea0577unknown10 years ago | 28 | case "android": |
bc7a32ceJimmy Thomson10 years ago | 29 | let android: typeof AndroidPlatform = require("./android/androidPlatform"); |
f8d32439dlebu10 years ago | 30 | return new android.AndroidPlatform(); |
f5ea0577unknown10 years ago | 31 | default: |
3af9a124unknown10 years ago | 32 | return null; |
f5ea0577unknown10 years ago | 33 | } |
| 34 | } | |
| 35 | } |