本文整理汇总了TypeScript中open.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: openUrl
export default function openUrl(url: string) {
try {
open(url);
}
catch (error) {
vscode.window.showErrorMessage('Couldn\'t open URL. ' + url);
console.error(error.stack);
}
}
示例2: run
run(parsers:IParser[]){
if(_.isUndefined(parsers)){
parsers = [];
}
parsers.push(new Haskell.HaskellParser());
var config = new Config.Config().getConfig();
var server = new Server.Server(process.env.PORT || config.port, config);
var watchPaths = [config.projectSource + "/dist/test/"];
var fileWatcher = new FileWatcher.FileWatcher(watchPaths, path => {
try{
for(var i = 0; i< parsers.length; i++){
var contents = parsers[i].parseFile(path);
server.notifyConnections(contents);
console.log((path + " changed").cyan);
return;
}
}
catch(e){
}
});
server.start();
open("http://localhost:" + server.port);
}
示例3: open
.then(function(res) {
let page = res.body.html_url
if (!page) {
return vscode.window.showErrorMessage(res.body && res.body.message ? res.body.message : "Could not create gist");
}
open(page);
})
示例4: require
const server = app.listen(PORT, HOST, (error: Error) => {
if (error) {
return console.error(error);
}
const open = require('open');
open(`http://${HOST}:${PORT}`, { app: 'chrome' }).then((c: { pid: string; }) => {
console.log('Chrome PID ' + c.pid);
}).catch((e: Error) => {
console.error('Could not open Chrome Browser.', e);
})
console.log(`\n\nDev server listening on port ${PORT} at ${HOST}: \n\n`);
spawn('npm', ['run', 'watch'], {
shell: true,
env: process.env,
stdio: 'inherit'
})
.on('close', code => process.exit(code))
.on('error', spawnError => console.error(spawnError));
})
示例5: serve
serve(log).then((url) => {
console.log(url);
// Open the program in the browser.
let query = querystring.stringify({ code });
open_url(url + '/#' + query);
});
示例6: function
export const server = app.listen(ARGS.port, function () {
const port = server.address().port;
console.log("Server started on port " + port);
if (ARGS.open) {
open('http://0.0.0.0:' + port);
}
});
示例7: openGistInBrowser
export function openGistInBrowser() {
var curr_gist = getGistDetails();
if (!curr_gist) {
return vscode.window.showErrorMessage("First open a personal gist");
}
open("https://gist.github.com/" + curr_gist.id);
}
示例8: Init
async function Init() {
vscode.window.setStatusBarMessage("Checking for Github Token and GIST.", 2000);
var syncSetting: Setting = await common.InitSettings();
if (syncSetting.Token == null || syncSetting.Token == "") {
openurl("https://github.com/settings/tokens");
await common.GetTokenAndSave(syncSetting).then(function(saved: boolean) {
if (saved) {
Init();
return;
}
else {
vscode.window.showErrorMessage("TOKEN NOT SAVED");
return;
}
}, function(err: any) {
console.error(err);
vscode.window.showErrorMessage(common.ERROR_MESSAGE);
return;
});
}
else {
myGi = new myGit.GithubService(syncSetting.Token);
vscode.window.setStatusBarMessage("Uploading / Updating Your Settings In Github.", 3000);
await startGitProcess(syncSetting);
return;
}
}
示例9: map
map(buildEvent => {
if (first && options.open) {
first = false;
open(openAddress);
}
return { ...buildEvent, baseUrl: openAddress } as DevServerBuilderOutput;
}),
示例10: require
goToSettingsMessage, getDotNetMessage).then(value => {
if (value === getDotNetMessage) {
let open = require('open');
open('https://www.microsoft.com/net/core');
} else if (value === goToSettingsMessage) {
vscode.commands.executeCommand('workbench.action.openGlobalSettings');
}
});