本文整理汇总了TypeScript中browser-window.loadURL函数的典型用法代码示例。如果您正苦于以下问题:TypeScript loadURL函数的具体用法?TypeScript loadURL怎么用?TypeScript loadURL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadURL函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getMainWindow
function getMainWindow() {
const workAreaSize = require('screen').getPrimaryDisplay().workAreaSize;
if (!browserWindow) {
browserWindow = new BrowserWindow({
'web-preferences': {
'experimental-features': true,
'experimental-canvas-features': true,
'subpixel-font-scaling': true,
'overlay-scrollbars': true
},
resizable: true,
'min-width': 500,
'min-height': 300,
width: workAreaSize.width,
height: workAreaSize.height,
show: false
});
browserWindow.loadURL('file://' + __dirname + '/../views/index.html');
menu.setMenu(app, browserWindow);
browserWindow.on('closed', (): void => browserWindow = null);
browserWindow.webContents.on('did-finish-load', () => {
browserWindow.show();
browserWindow.focus();
});
}
return browserWindow;
}
示例2: function
app.on('ready', function() {
mainWindow = new BrowserWindow({width: 800, height: 600});
mainWindow.loadURL('file://' + __dirname + '/../html/index.html');
mainWindow.on('closed', function() {
mainWindow = null;
});
})
示例3: getMainWindow
function getMainWindow(): Electron.BrowserWindow {
const screen: Electron.Screen = require("screen");
const workAreaSize = screen.getPrimaryDisplay().workAreaSize;
if (!browserWindow) {
let options: Electron.BrowserWindowOptions = {
webPreferences: {
experimentalFeatures: true,
experimentalCanvasFeatures: true,
},
titleBarStyle: "hidden",
resizable: true,
minWidth: 500,
minHeight: 300,
width: workAreaSize.width,
height: workAreaSize.height,
show: false,
};
browserWindow = new browserWindowConstructor(options);
browserWindow.loadURL("file://" + __dirname + "/../views/index.html");
menu.setMenu(app, browserWindow);
browserWindow.on("closed", (): void => browserWindow = undefined)
.on("focus", (): void => app.dock && app.dock.setBadge(""));
browserWindow.webContents.on("did-finish-load", () => {
browserWindow.show();
browserWindow.focus();
});
}
return browserWindow;
}
示例4: function
app.on('ready', function() {
loadingWindow = new BrowserWindow({
width: 600,
height: 200,
titleBarStyle: 'hidden',
frame: false,
resizable: false,
movable: false,
minimizable: false,
maximizable: false,
});
loadingWindow.loadURL('file://' + __dirname + '/views/loader.html');
ldm.download().then((d)=>{
console.log('etape1')
ldm.parse().then((datas)=>{
console.log('etape2')
ldm.populate(datas).then(()=>{
console.log('etape3')
startApp();
})
});
}).fail((d)=>{
fs.stat(ldm.xmlFileLocal, function(err, stats){
if( err ) {
dialog.showMessageBox(loadingWindow, {
type: 'error',
buttons: ['ok'],
message: 'Impossible de rĂŠcupĂŠrer les informations distante, ressayer plus tard.'
}, function(d){
loadingWindow.destroy();
app.quit();
});
} else {
loadingWindow.destroy();
startApp();
}
})
});
});
示例5: BrowserWindow
app.on('ready', () => {
// Initialize the window to our specified dimensions
mainWindow = new BrowserWindow({ width: 900, height: 620 });
// Tell Electron where to load the entry point from
mainWindow.loadURL('file://' + __dirname + '/index.html');
// Clear out the main window when the app is closed
mainWindow.on('closed', () => {
mainWindow = null;
});
mainWindow.webContents.on('did-navigate-in-page', (e: any, url: string) => {
console.log(`Page navigated: ${url}`);
});
let appTitle: string = `Angular 2 Seed Advanced`;
let langMenu: any = {
label: 'Language',
submenu: []
};
for (let lang of AppConfigService.SUPPORTED_LANGUAGES) {
let langOption = {
label: lang.title,
click:() => {
console.log(`Change lang: ${lang.code}`);
mainWindow.webContents.executeJavaScript(`window.dispatchEvent(new CustomEvent('changeLang', {detail: { value: '${lang.code}'} }));`);
}
};
langMenu.submenu.push(langOption);
}
let helpMenu: any = {
label: 'Help',
submenu: [{
label: 'Learn More',
click:() => {
shell.openExternal('https://github.com/NathanWalker/angular2-seed-advanced');
}
}, {
label: 'Issues',
click:() => {
shell.openExternal('https://github.com/NathanWalker/angular2-seed-advanced/issues');
}
}, {
label: `My Amazing Parent: Minko Gechev's Angular 2 Seed`,
click:() => {
shell.openExternal('https://github.com/mgechev/angular2-seed');
}
}, {
label: 'Angular 2',
click:() => {
shell.openExternal('https://angular.io/');
}
}, {
label: 'Electron',
click:() => {
shell.openExternal('http://electron.atom.io/');
}
}, {
label: 'Electron Docs',
click: () => {
shell.openExternal('https://github.com/atom/electron/tree/master/docs');
}
}, {
label: 'Codeology Visualization',
click:() => {
shell.openExternal('http://codeology.braintreepayments.com/nathanwalker/angular2-seed-advanced');
}
}]
};
if (process.platform === 'darwin') {
template = [{
label: appTitle,
submenu: [{
label: `About ${appTitle}`,
selector: 'orderFrontStandardAboutPanel:'
}, {
type: 'separator'
}, {
label: 'Services',
submenu: []
}, {
type: 'separator'
}, {
label: 'Hide Angular 2 Seed Advanced',
accelerator: 'Command+H',
selector: 'hide:'
}, {
label: 'Hide Others',
accelerator: 'Command+Shift+H',
selector: 'hideOtherApplications:'
}, {
label: 'Show All',
selector: 'unhideAllApplications:'
}, {
type: 'separator'
//.........这里部分代码省略.........