优化代码逻辑,修复潜在播放问题
This commit is contained in:
@@ -44,7 +44,7 @@ export const createClientKeyInfo = (deviceName: string): LX.Sync.KeyInfo => {
|
||||
deviceName,
|
||||
}
|
||||
const store = getStore(STORE_NAME)
|
||||
if (!keyInfos) keyInfos = store.get('keys') as KeyInfos || {}
|
||||
keyInfos ??= store.get('keys') as KeyInfos || {}
|
||||
if (Object.keys(keyInfos).length > 101) throw new Error('max keys')
|
||||
|
||||
keyInfos[keyInfo.clientId] = keyInfo
|
||||
|
||||
@@ -27,7 +27,7 @@ const winEvent = () => {
|
||||
|
||||
export const createWindow = async(userApi: LX.UserApi.UserApiInfo) => {
|
||||
await closeWindow()
|
||||
if (!dir) dir = global.isDev ? webpackUserApiPath : join(encodePath(__dirname), 'userApi')
|
||||
dir ??= global.isDev ? webpackUserApiPath : join(encodePath(__dirname), 'userApi')
|
||||
|
||||
if (!html) {
|
||||
html = await fs.promises.readFile(join(dir, 'renderer/user-api.html'), 'utf8')
|
||||
|
||||
@@ -33,7 +33,7 @@ export const importApi = (script: string): LX.UserApi.UserApiInfo => {
|
||||
script,
|
||||
allowShowUpdateAlert: true,
|
||||
}
|
||||
if (!userApis) userApis = []
|
||||
userApis ??= []
|
||||
userApis.push(apiInfo)
|
||||
getStore(STORE_NAMES.USER_API).set('userApis', userApis)
|
||||
return apiInfo
|
||||
|
||||
@@ -20,7 +20,7 @@ const winEvent = () => {
|
||||
return
|
||||
}
|
||||
|
||||
if (global.lx.isTrafficLightClose) global.lx.isTrafficLightClose = false
|
||||
global.lx.isTrafficLightClose &&= false
|
||||
event.preventDefault()
|
||||
browserWindow!.hide()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user