mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 10:22:07 +08:00
Adds a proxy page scenario to the measurement adapter: a core-module shim serves synthetic proxy/clash/run-state data at the invoke seam (active only for the proxy scenario; other scenarios stay byte-identical), and a sawtooth scroll driver keeps the virtualizer measuring and the throttled scroll-position save running. Running the scene additionally requires the harness-side scenario contract and schema v10 from the clash-verge-rev-harness repository.
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { layer, scenario, startReplay } from './replay'
|
|
|
|
if (scenario === 'traffic') {
|
|
await import('./traffic')
|
|
} else if (scenario === 'proxy') {
|
|
await import('./proxy')
|
|
} else {
|
|
const root = document.getElementById('root')!
|
|
document.body.style.cssText = 'margin:0;font:14px -apple-system,sans-serif'
|
|
root.style.cssText = 'width:1000px;height:700px;overflow:hidden'
|
|
new MutationObserver(() => {
|
|
document.documentElement.dataset.perfDraw = String(Date.now())
|
|
}).observe(root, { childList: true, characterData: true, subtree: true })
|
|
window.addEventListener('error', (event) => {
|
|
document.documentElement.dataset.perfError = event.message
|
|
})
|
|
window.addEventListener('unhandledrejection', (event) => {
|
|
document.documentElement.dataset.perfError = String(event.reason)
|
|
})
|
|
if (layer === 'dom') {
|
|
const { mount } = await import('./minimal')
|
|
mount(root)
|
|
} else {
|
|
if (layer === 'page') {
|
|
const { installAdapter } = await import('./adapter')
|
|
installAdapter()
|
|
}
|
|
await import('./scenes')
|
|
}
|
|
startReplay()
|
|
}
|