本文整理匯總了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');
}
});