當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript opn.default函數代碼示例

本文整理匯總了TypeScript中opn.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了default函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: opn

app.listen(port, (err) => {
  if (err) {
    return console.log('something bad happened', err)
  }
  opn('http://localhost:5000')
  return console.log(`server is listening on ${port}`)
})
開發者ID:blockstack,項目名稱:blockstack-cli,代碼行數:7,代碼來源:proofs-server.ts

示例2: openLinkInBrowser

 /**
  * Opens the specified URL and appends the specified object (if defined)
  * as query string parameters
  */
 public static openLinkInBrowser(link: string, args?: any, hash?: string): Thenable<void> {
     let qs = [];
     if (args) {
         // check arguments
         for(let name in args) {
             if (args.hasOwnProperty(name)) {
                 qs.push(
                     name + '=' + encodeURIComponent(args[name])
                 );
             }
         }
     }
     // append the query string if defined
     if (qs.length > 0) {
         if (link.indexOf('?') > -1) {
             link += '&' + qs.join('&');
         } else {
             link += '?' + qs.join('&');
         }
     }
     // appends the hash directive
     if (hash) {
         if (hash[0] != '#') {
             hash = '#' + hash;
         }
         link += hash;
     }
     return opn(link);
 }
開發者ID:HvyIndustries,項目名稱:crane,代碼行數:33,代碼來源:crane.ts

示例3: reject

 server.listen(serveTaskOptions.port, serveTaskOptions.host, (err: any, _stats: any) => {
   if (err) {
     return reject(err);
   }
   if (serveTaskOptions.open) {
     opn(serverAddress);
   }
 });
開發者ID:RoPP,項目名稱:angular-cli,代碼行數:8,代碼來源:serve.ts

示例4: map

      map(buildEvent => {
        if (first && options.open) {
          first = false;
          opn(opnAddress);
        }

        return buildEvent;
      }),
開發者ID:fmalcher,項目名稱:angular-cli,代碼行數:8,代碼來源:index.ts

示例5: reject

 (err: any, _stats: any) => {
   if (err) {
     return reject(err);
   }
   if (serveTaskOptions.open) {
     opn(serverAddress + servePath);
   }
 });
開發者ID:Serdji,項目名稱:angular-cli,代碼行數:8,代碼來源:serve.ts

示例6: run

  public async run(options: DocCommandSchema & Arguments) {
    let searchUrl = `https://angular.io/api?query=${options.keyword}`;
    if (options.search) {
      searchUrl = `https://www.google.com/search?q=site%3Aangular.io+${options.keyword}`;
    }

    return opn(searchUrl, {
      wait: false,
    });
  }
開發者ID:DevIntent,項目名稱:angular-cli,代碼行數:10,代碼來源:doc-impl.ts

示例7: function

 server.listen(commandOptions.port, `${commandOptions.host}`, function(err: any, stats: any) {
   if (err) {
     console.error(err.stack || err);
     if (err.details) { console.error(err.details); }
     reject(err.details);
   } else {
     const { open, host, port } = commandOptions;
     if (open) {
       opn(url.format({ protocol: 'http', hostname: host, port: port.toString() }));
     }
   }
 });
開發者ID:filoxo,項目名稱:angular-cli,代碼行數:12,代碼來源:serve-webpack.ts

示例8: opn

        return Printer.write(results, flags.output, outputPath).then(results => {
          if (flags.output === Printer.OutputMode[Printer.OutputMode.html] ||
              flags.output === Printer.OutputMode[Printer.OutputMode.domhtml]) {
            if (flags.view) {
              opn(outputPath, {wait: false});
            } else {
              log.log('CLI', 'Protip: Run lighthouse with `--view` to immediately open the HTML report in your browser');
            }
          }

          return results;
        });
開發者ID:CondeNast,項目名稱:lighthouse,代碼行數:12,代碼來源:bin.ts

示例9: reject

 server.listen(serveTaskOptions.port, `${serveTaskOptions.host}`, (err: any, stats: any) => {
   if (err) {
     console.error(err.stack || err);
     if (err.details) { console.error(err.details); }
     reject(err.details);
   } else {
     const { open, ssl, host, port } = serveTaskOptions;
     if (open) {
       let protocol = ssl ? 'https' : 'http';
       opn(url.format({ protocol: protocol, hostname: host, port: port.toString() }));
     }
   }
 });
開發者ID:marc-sensenich,項目名稱:angular-cli,代碼行數:13,代碼來源:serve-webpack.ts

示例10: opnWrapper

export function opnWrapper(url, name, bs) {
    var options = (function () {
        if (_.isString(name)) {
            return {app: name};
        }
        if (Immutable.Map.isMap(name)) {
            return name.toJS();
        }
        return {};
    })();
    var opn = require("opn");
    opn(url, options).catch(function () {
        bs.events.emit("browser:error");
    });
}
開發者ID:BrowserSync,項目名稱:browser-sync,代碼行數:15,代碼來源:utils.ts


注:本文中的opn.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。