cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [06/24] cordova-serve git commit: Add support for --target=edge to launch app in Edge browser.
Date Tue, 06 Jun 2017 05:43:12 GMT
Add support for --target=edge to launch app in Edge browser.


Project: http://git-wip-us.apache.org/repos/asf/cordova-serve/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-serve/commit/dc8bea29
Tree: http://git-wip-us.apache.org/repos/asf/cordova-serve/tree/dc8bea29
Diff: http://git-wip-us.apache.org/repos/asf/cordova-serve/diff/dc8bea29

Branch: refs/heads/master
Commit: dc8bea295a92ce88be81ea71c469f23b2080f00d
Parents: c2c1167
Author: Tim Barham <tim.barham@microsoft.com>
Authored: Tue Jul 14 09:06:41 2015 +1000
Committer: Tim Barham <tim.barham@microsoft.com>
Committed: Tue Jul 14 09:13:43 2015 +1000

----------------------------------------------------------------------
 src/browser.js | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-serve/blob/dc8bea29/src/browser.js
----------------------------------------------------------------------
diff --git a/src/browser.js b/src/browser.js
index 5b3b40e..2eb78df 100644
--- a/src/browser.js
+++ b/src/browser.js
@@ -30,12 +30,13 @@ var exec = require('./exec'),
  * @return {Q} Promise to launch the specified browser
  */
 module.exports = function (opts) {
-    //target, url, dataDir
     var target = opts.target || 'chrome';
     var url = opts.url || '';
 
     return getBrowser(target, opts.dataDir).then(function (browser) {
         var args;
+
+        var urlAdded = false;
         switch (process.platform) {
             case 'darwin':
                 args = ['open'];
@@ -51,7 +52,13 @@ module.exports = function (opts) {
                 // responsibility to "cmd /c", which has that logic built in. 
                 // 
                 // Furthermore, if "cmd /c" double-quoted the first parameter, then "start"
will interpret it as a window title, 
-                // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191

+                // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
+
+                if (target === 'edge') {
+                    browser += ':' + url;
+                    urlAdded = true;
+                }
+
                 args = ['cmd /c start ""', browser];
                 break;
             case 'linux':
@@ -60,7 +67,10 @@ module.exports = function (opts) {
                 args = [browser];
                 break;
         }
-        args.push(url);
+
+        if (!urlAdded) {
+            args.push(url);
+        }
         var command = args.join(' ');
         console.log('Executing command: ' + command);
         return exec(command);
@@ -77,7 +87,8 @@ function getBrowser(target, dataDir) {
             'chrome': 'chrome --user-data-dir=%TEMP%\\' + dataDir,
             'safari': 'safari',
             'opera': 'opera',
-            'firefox': 'firefox'
+            'firefox': 'firefox',
+            'edge': 'microsoft-edge'
         },
         'darwin': {
             'chrome': '"Google Chrome" --args' + chromeArgs,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message