本文整理汇总了TypeScript中electron.screen.getDisplayNearestPoint方法的典型用法代码示例。如果您正苦于以下问题:TypeScript screen.getDisplayNearestPoint方法的具体用法?TypeScript screen.getDisplayNearestPoint怎么用?TypeScript screen.getDisplayNearestPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.screen
的用法示例。
在下文中一共展示了screen.getDisplayNearestPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: BrowserWindow
app.on('ready', () => {
let cursorPos = screen.getCursorScreenPoint()
let workAreaSize = screen.getDisplayNearestPoint(cursorPos).workAreaSize
app.setName('Ansel')
mainWindow = new BrowserWindow({
width: 1356,
height: 768,
title: 'Ansel',
titleBarStyle: 'hiddenInset',
backgroundColor: '#37474f', // @blue-grey-800
webPreferences: {
experimentalFeatures: true,
blinkFeatures: 'CSSGridLayout'
}
})
if (workAreaSize.width <= 1366 && workAreaSize.height <= 768)
mainWindow.maximize()
mainWindow.loadURL('file://' + __dirname + '/../../static/index.html')
mainWindow.setTitle('Ansel')
initBackgroundService(mainWindow)
initForegroundClient(mainWindow)
//let usb = new Usb()
//
//usb.scan((err, drives) => {
// mainWindow.webContents.send('scanned-devices', drives)
//})
//
//usb.watch((err, action, drive) => {
// if (action === 'add')
// mainWindow.webContents.send('add-device', drive)
// else
// mainWindow.webContents.send('remove-device', drive)
//})
if (fs.existsSync(config.settings)) {
initLibrary(mainWindow)
} else {
initDb()
ipcMain.on('settings-created', () => initLibrary(mainWindow))
}
// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
})
示例2:
socket.on('screen-getDisplayNearestPoint', (point) => {
var display = screen.getDisplayNearestPoint(point);
socket.emit('screen-getDisplayNearestPointCompleted', display);
});