microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.3.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/common/exponent/exponentPlatform.ts

43lines · modecode

1// 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";
8import {GeneralMobilePlatform} from "../generalMobilePlatform";
9
10import * as Q from "q";
11
12export class ExponentPlatform extends GeneralMobilePlatform {
13 private exponentTunnelPath: string;
14
15 constructor(runOptions: IRunOptions, { remoteExtension = null } = {}) {
16 super(runOptions, { remoteExtension: remoteExtension });
17 this.exponentTunnelPath = null;
18 }
19
20 public runApp(): Q.Promise<void> {
21 const outputMessage = `Application is running on Exponent. Open your exponent app at ${this.exponentTunnelPath} to see it.`;
22 Log.logMessage(outputMessage);
23 this.remoteExtension.showInformationMessage(outputMessage);
24 return Q.resolve<void>(void 0);
25 }
26
27 public enableJSDebuggingMode(): Q.Promise<void> {
28 Log.logMessage("Application is running on Exponent. Please shake device and select 'Debug JS Remotely' to enable debugging.");
29 return Q.resolve<void>(void 0);
30 }
31
32 public startPackager(): Q.Promise<void> {
33 Log.logMessage("Starting Exponent Packager.");
34 return this.remoteExtension.startExponentPackager()
35 .then(exponentUrl => {
36 if (!exponentUrl) {
37 return Q.reject<void>(ErrorHelper.getInternalError(InternalErrorCode.ExpectedExponentTunnelPath,
38 "No link provided by exponent. Is your project correctly setup?"));
39 }
40 this.exponentTunnelPath = exponentUrl;
41 });
42 }
43}