本文整理汇总了TypeScript中electron.BrowserWindow.close方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.close方法的具体用法?TypeScript BrowserWindow.close怎么用?TypeScript BrowserWindow.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
aboutWindow.webContents.on('before-input-event', (event, input) => {
if (input.type === 'keyDown' && input.key === 'Escape') {
if (aboutWindow) {
aboutWindow.close();
}
}
});
示例2: reject
const onConvertBmpToPngResult = (event: any, error: any, data: string) => {
if (browserWindow.webContents === event.sender) {
if (error) {
reject(error);
} else {
resolve(data);
}
browserWindow.close();
ipcMain.removeListener("convertBmpToPngResult", onConvertBmpToPngResult);
}
};
示例3:
fs.writeFile(filename, data, (err) => {
if (err) throw err;
console.log('Write PDF successfully.');
dialog.showMessageBox({
type: 'info',
title: 'PDF Saved',
message: 'Brochure rendered and saved to file.',
buttons: ['OK'],
});
if (!debug) {
brochureWindow.close();
}
});
示例4: async
export const closeWindow = async (
window: BrowserWindow | null = null,
{ assertNotWindows } = { assertNotWindows: true }
) => {
if (window && !window.isDestroyed()) {
const isClosed = emittedOnce(window, 'closed')
window.setClosable(true)
window.close()
await isClosed
}
if (assertNotWindows) {
expect(BrowserWindow.getAllWindows()).to.have.lengthOf(0)
}
}
示例5:
authWindow.webContents.on('did-get-redirect-request', (_, oldUrl, newUrl) => {
const matched = newUrl.match(/\?oauth_token=([^&]*)&oauth_verifier=([^&]*)/)
if (matched) {
authWindow.close()
const oauthVerifier = matched[2]
twitterAuth.getAccessToken(requestToken, oauthVerifier)
.then(accessToken => {
const twitterCredentials = {
consumerKey: apiKey.consumerKey,
consumerSecret: apiKey.consumerSecret,
accessToken: accessToken.accessToken,
accessTokenSecret: accessToken.accessTokenSecret,
}
resolve(twitterCredentials)
})
}
})
示例6: writeFile
writeFile(config_path, JSON.stringify(access), e => {
if (e) {
log.warn('Failed to store tokens to a token.json', e);
}
login_window.close();
});
示例7: setTimeout
setTimeout(() => login_window.close(), 0);
示例8: async
ipcMain.on("startSetup", async (event: Event) => {
await doSetup(event.sender);
win.close();
resolve();
});
示例9: setTimeout
setTimeout(() => {
win.close();
}, 15 * 1000);
示例10:
ipcMain.on('close', () => {
win.close();
});