更新6.x的API
parent
d1dcba7711
commit
b72a8d4780
|
@ -25,15 +25,14 @@ const log = console.log
|
||||||
const fs = require('iofs')
|
const fs = require('iofs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const { remote, ipcRenderer, screen } = require('electron')
|
const { remote, ipcRenderer } = require('electron')
|
||||||
const { createDesktopLrcWindow, createMiniWindow } = remote.require(
|
const { createDesktopLrcWindow, createMiniWindow } = remote.require(
|
||||||
'./tools/windows'
|
'./tools/windows'
|
||||||
)
|
)
|
||||||
const MAIN_SCREEN = screen.getPrimaryDisplay()
|
|
||||||
|
|
||||||
const WIN = remote.getCurrentWindow()
|
const WIN = remote.getCurrentWindow()
|
||||||
const __LRC__ = createDesktopLrcWindow(MAIN_SCREEN)
|
const __LRC__ = createDesktopLrcWindow(screen)
|
||||||
const __MINI__ = createMiniWindow(MAIN_SCREEN)
|
const __MINI__ = createMiniWindow(screen)
|
||||||
|
|
||||||
const PLAY_MODE = {
|
const PLAY_MODE = {
|
||||||
0: 'all',
|
0: 'all',
|
||||||
|
|
|
@ -41,7 +41,9 @@ const ROOT = __dirname
|
||||||
app.commandLine.appendSwitch('--lang', 'zh-CN')
|
app.commandLine.appendSwitch('--lang', 'zh-CN')
|
||||||
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required')
|
app.commandLine.appendSwitch('--autoplay-policy', 'no-user-gesture-required')
|
||||||
|
|
||||||
protocol.registerStandardSchemes(['app'], { secure: true })
|
protocol.registerSchemesAsPrivileged([
|
||||||
|
{ scheme: 'app', privileges: { secure: true, standard: true } }
|
||||||
|
])
|
||||||
|
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ exports.createMainWindow = function(icon) {
|
||||||
icon,
|
icon,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
webSecurity: false,
|
webSecurity: false,
|
||||||
experimentalFeatures: true
|
experimentalFeatures: true,
|
||||||
|
nodeIntegration: true
|
||||||
},
|
},
|
||||||
show: false
|
show: false
|
||||||
})
|
})
|
||||||
|
@ -74,12 +75,15 @@ exports.createDesktopLrcWindow = function(screen) {
|
||||||
resizable: false,
|
resizable: false,
|
||||||
alwaysOnTop: true,
|
alwaysOnTop: true,
|
||||||
skipTaskbar: true,
|
skipTaskbar: true,
|
||||||
x: (screen.size.width - 1024) / 2,
|
x: (screen.width - 1024) / 2,
|
||||||
y: screen.size.height - 100,
|
y: screen.height - 100,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
hasShadow: false,
|
hasShadow: false,
|
||||||
thickFrame: false,
|
thickFrame: false,
|
||||||
show: false
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
win.loadURL('app://local/desktop-lrc.html')
|
win.loadURL('app://local/desktop-lrc.html')
|
||||||
|
@ -98,10 +102,13 @@ exports.createMiniWindow = function(screen) {
|
||||||
resizable: false,
|
resizable: false,
|
||||||
alwaysOnTop: true,
|
alwaysOnTop: true,
|
||||||
skipTaskbar: true,
|
skipTaskbar: true,
|
||||||
x: screen.size.width - 320,
|
x: screen.width - 320,
|
||||||
y: 0,
|
y: 0,
|
||||||
thickFrame: false,
|
thickFrame: false,
|
||||||
show: false
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
win.loadURL('app://local/mini-win.html')
|
win.loadURL('app://local/mini-win.html')
|
||||||
|
|
Reference in New Issue