microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.4.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/common/exponent/exponentPlatform.ts

43lines · modeblame

1c32fe84Patricio Beltran9 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 {ErrorHelper} from "../error/errorHelper";
5import {InternalErrorCode} from "../error/internalErrorCode";
6import {IRunOptions} from "../launchArgs";
7import {Log} from "../log/log";
5c8365a6Artem Egorov8 years ago8import {GeneralMobilePlatform, MobilePlatformDeps} from "../generalMobilePlatform";
1c32fe84Patricio Beltran9 years ago9
10import * as Q from "q";
11
12export class ExponentPlatform extends GeneralMobilePlatform {
5c8365a6Artem Egorov8 years ago13private exponentTunnelPath: string | null;
1c32fe84Patricio Beltran9 years ago14
5c8365a6Artem Egorov8 years ago15constructor(runOptions: IRunOptions, {remoteExtension}: MobilePlatformDeps = {}) {
1c32fe84Patricio Beltran9 years ago16super(runOptions, { remoteExtension: remoteExtension });
17this.exponentTunnelPath = null;
18}
19
20public runApp(): Q.Promise<void> {
280c0746Patricio Beltran9 years ago21const outputMessage = `Application is running on Exponent. Open your exponent app at ${this.exponentTunnelPath} to see it.`;
22Log.logMessage(outputMessage);
1c32fe84Patricio Beltran9 years ago23return Q.resolve<void>(void 0);
24}
25
26public enableJSDebuggingMode(): Q.Promise<void> {
27Log.logMessage("Application is running on Exponent. Please shake device and select 'Debug JS Remotely' to enable debugging.");
28return Q.resolve<void>(void 0);
29}
30
31public startPackager(): Q.Promise<void> {
4052c7eddaserge9 years ago32Log.logMessage("Starting Exponent Packager.");
1c32fe84Patricio Beltran9 years ago33return this.remoteExtension.startExponentPackager()
34.then(exponentUrl => {
35if (!exponentUrl) {
36return Q.reject<void>(ErrorHelper.getInternalError(InternalErrorCode.ExpectedExponentTunnelPath,
37"No link provided by exponent. Is your project correctly setup?"));
38}
39this.exponentTunnelPath = exponentUrl;
5c8365a6Artem Egorov8 years ago40return Q.resolve(void 0);
1c32fe84Patricio Beltran9 years ago41});
42}
e23fa745Vladimir Kotikov9 years ago43}