修复注册的事件未被清理的问题

This commit is contained in:
lyswhut
2024-04-02 11:07:50 +08:00
parent 274f71615f
commit e60c2f5f19
12 changed files with 36 additions and 47 deletions
@@ -231,7 +231,7 @@ export default class LinePlayer {
timeoutTools.cancelNextTick = window.cancelAnimationFrame.bind(window)
} else {
timeoutTools.nextTick = (handler) => {
return setTimeout(handler, 80)
return setTimeout(handler, 20)
}
timeoutTools.cancelNextTick = clearTimeout.bind(global)
}
+18
View File
@@ -2,6 +2,7 @@ import fs from 'node:fs'
import crypto from 'node:crypto'
import { gzip, gunzip } from 'node:zlib'
import path from 'node:path'
import { networkInterfaces } from 'node:os'
import { log } from '@common/utils'
export const joinPath = (...paths: string[]): string => path.join(...paths)
@@ -185,3 +186,20 @@ export const copyFile = async(sourcePath: string, distPath: string) => {
export const moveFile = async(sourcePath: string, distPath: string) => {
return fs.promises.rename(sourcePath, distPath)
}
export const getAddress = (): string[] => {
const nets = networkInterfaces()
const results: string[] = []
// console.log(nets)
for (const interfaceInfos of Object.values(nets)) {
if (!interfaceInfos) continue
// Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
for (const interfaceInfo of interfaceInfos) {
if (interfaceInfo.family === 'IPv4' && !interfaceInfo.internal) {
results.push(interfaceInfo.address)
}
}
}
return results
}