优化目录结构

This commit is contained in:
2026-05-25 20:37:36 +08:00
parent bbe7e71274
commit 40fd7f7e08
101 changed files with 108 additions and 110 deletions

View File

@@ -0,0 +1,16 @@
// mock class
export class DOMRect {
constructor(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
get left() {
return this.x;
}
get top() {
return this.y;
}
}

View File

@@ -0,0 +1,11 @@
// mock class
export class DOMHTMLVideoElement {
constructor(rect) {
this.rect = rect;
}
getBoundingClientRect() {
return this.rect;
}
}

View File

@@ -0,0 +1,18 @@
// mock class
/* eslint-disable no-unused-vars */
let instanceResize = null;
/* eslint-disable no-unused-vars */
let callbackResize = null;
export default class ResizeObserverMock {
constructor(callback) {
instanceResize = this;
callbackResize = callback;
}
disconnect() { }
/* eslint-disable no-unused-vars */
observe(target, options) { }
/* eslint-disable no-unused-vars */
unobserve(target) { }
}

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;
}