This commit is contained in:
zhangzheng
2026-02-27 18:35:40 +08:00
parent adef8b4cce
commit 1bb1fee5cc
265 changed files with 104076 additions and 92 deletions

View File

@@ -0,0 +1,39 @@
import process from "process";
export function waitFor(conditionFunction) {
const poll = resolve => {
if (conditionFunction()) resolve();
else setTimeout(() => poll(resolve), 100);
};
return new Promise(poll);
}
export async function sleep(milisecond) {
return new Promise(resolve => setTimeout(resolve, milisecond));
}
export function serverExeName() {
switch (process.platform) {
case 'win32':
return 'webserver.exe';
case 'darwin':
return 'webserver_mac';
case 'linux':
return 'webserver';
default:
return null;
}
}
export function getUniqueId() {
return new Date().getTime().toString(16) + Math.floor(1000 * Math.random()).toString(16);
}
export function getRTCConfiguration() {
let config = {};
config.sdpSemantics = 'unified-plan';
config.iceServers = [{ urls: ['stun:stun.l.google.com:19302'] }];
return config;
}