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