本文整理汇总了TypeScript中electron.BrowserWindow.once方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.once方法的具体用法?TypeScript BrowserWindow.once怎么用?TypeScript BrowserWindow.once使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.once方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: openMainWindow
export function openMainWindow() {
console.log('open main window')
mainWindow = new BrowserWindow({
width: 1200,
height: isDev ? 900 : 720, // create room for dev tools
show: false
})
mainWindow.loadURL(`file://${getAppFolder()}/src/main.html`)
if (isDev) {
mainWindow.webContents.openDevTools()
}
mainWindow.once('ready-to-show', () => {
useShortcut('CommandOrControl+D', mainWindow)
mainWindow.show()
mainWindow.focus()
})
mainWindow.on('closed', () => {
unregisterShortcuts(mainWindow)
mainWindow = null
})
}
示例2: openOnboardingWindow
export function openOnboardingWindow() {
console.log('open onboarding window')
onboardingWindow = new BrowserWindow({
width: 450,
height: 320,
show: false,
resizable: false,
titleBarStyle: 'hidden',
type: 'splash'
})
onboardingWindow.loadURL(`file://${getAppFolder()}/src/onboarding.html`)
onboardingWindow.once('ready-to-show', () => {
onboardingWindow.show()
})
ipcMain.on('onboarding-finished', () => {
openMainWindow()
onboardingWindow.close()
})
onboardingWindow.on('closed', () => {
onboardingWindow = null
})
}
示例3: BrowserWindow
app.on('ready',() =>{
tcp.listen(3999,()=>{
console.log('Lisening :3999')
})
let win = new BrowserWindow({width: 800, height: 600})
// win.openDevTools()
win.once('focus', () => win.flashFrame(false))
win.flashFrame(true)
});
示例4:
main.on('close', event => {
if (!isQuitting) {
event.preventDefault();
logger.log('Closing window...');
if (main.isFullScreen()) {
logger.log('Fullscreen detected, leaving full screen before hiding...');
main.once('leave-full-screen', () => main.hide());
main.setFullScreen(false);
} else {
main.hide();
}
}
systemMenu.unregisterShortcuts();
});
示例5: createWindow
function createWindow() {
win = new BrowserWindow({ width: 800, height: 600, show: false });
win.setMenu(null);
win.setMenuBarVisibility(false);
win.maximize();
win.loadURL("http://localhost:8080");
win.once('ready-to-show', () => {
win && win.show()
});
win.on("closed", () => {
win = null;
});
}
示例6: BrowserWindow
() => {
win = new BrowserWindow({
width: 565,
height: 233,
useContentSize: true,
title: "loading",
frame: false,
show: false
});
const index = join(__dirname, "..", "static", "splash.html");
win.loadURL(`file://${index}`);
win.once("ready-to-show", () => {
win.show();
});
},
示例7: openSummaryWindow
export function openSummaryWindow() {
console.log('open summary window')
summaryWindow = new BrowserWindow({
width: 1200,
height: isDev ? 900 : 710, // create room for dev tools
show: false
})
summaryWindow.loadURL(`file://${getAppFolder()}/src/summary.html`)
summaryWindow.once('ready-to-show', () => {
summaryWindow.show()
})
summaryWindow.on('closed', () => {
summaryWindow = null
})
}
示例8: BrowserWindow
ipcMain.on(OPEN_REMOTE_CONTROL, () => {
if (remoteWindow && !remoteWindow.isDestroyed()) {
return;
}
remoteWindow = new BrowserWindow({
height: 600,
width: 400,
minWidth: 300,
minHeight: 200,
backgroundColor: '#222',
show: false,
frame: true
});
remoteWindow.loadURL('file://' + __dirname + '/remote-control/index.html');
remoteWindow.setMenu(null);
remoteWindow.once('ready-to-show', () => {
remoteWindow.show();
});
});
示例9: launch
export function launch(filename?: string) {
const win = new BrowserWindow({
width: 800,
height: 1000,
icon: iconPath,
title: "nteract",
show: false
});
win.once("ready-to-show", () => {
win.show();
});
const index = path.join(__dirname, "..", "static", "index.html");
win.loadURL(`file://${index}`);
win.webContents.on("did-finish-load", () => {
const menu = loadFullMenu();
Menu.setApplicationMenu(menu);
if (filename !== undefined) {
win.webContents.send("main:load", filename);
}
win.webContents.send("main:load-config");
});
win.webContents.on("will-navigate", deferURL);
win.on("focus", () => {
const menu = loadFullMenu();
Menu.setApplicationMenu(menu);
});
win.on("show", () => {
const menu = loadFullMenu();
Menu.setApplicationMenu(menu);
});
// Emitted when the window is closed.
win.on("closed", () => {
const menu = loadFullMenu();
Menu.setApplicationMenu(menu);
});
return win;
}
示例10: BrowserWindow
bus.addListener('git:askpass', (context: ICredentialsContext) => {
var cachedResult = cache[context.id];
if (typeof cachedResult !== 'undefined') {
bus.emit('git:askpass:' + context.id, cachedResult.credentials);
return;
}
if (context.command === 'fetch') {
bus.emit('git:askpass:' + context.id, { id: context.id, credentials: { username: '', password: '' }});
return;
}
var win = new BrowserWindow({
alwaysOnTop: true,
skipTaskbar: true,
resizable: false,
width: 450,
height: platform.isWindows ? 280 : 260,
show: true,
title: env.product.nameLong
});
win.setMenuBarVisibility(false);
cache[context.id] = {
window: win,
credentials: null
};
win.loadURL(require.toUrl('vs/workbench/parts/git/electron-main/index.html'));
win.webContents.executeJavaScript('init(' + JSON.stringify(context) + ')');
win.once('closed', () => {
bus.emit('git:askpass:' + context.id, cache[context.id].credentials);
setTimeout(function () {
delete cache[context.id];
}, 1000 * 10);
});
});