Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

revert(wechat): performance polyfill back to the Date.now stub

yhh1a562ee85e2a
diff --git a/sdk/src/platform/wechat/index.ts b/sdk/src/platform/wechat/index.ts
index 7baa0c79a..57049f36c 100644
--- a/sdk/src/platform/wechat/index.ts
+++ b/sdk/src/platform/wechat/index.ts
@@ -264,15 +264,6 @@ export function initWeChatPlatform(): void {
function polyfillPerformance(): void {
const g = globalThis as any;
if (typeof g.performance !== 'undefined') return;
- // Prefer WeChat's own high-res clock: its framework SDK reads
- // globalThis.performance and needs the full object (getSystemNanoTime etc.),
- // not a bare { now } — a stub makes getFileSystemManager and friends throw.
- const wxAny = wx as unknown as { getPerformance?: () => { now?: () => number } };
- const wxPerf = typeof wxAny.getPerformance === 'function' ? wxAny.getPerformance() : null;
- if (wxPerf && typeof wxPerf.now === 'function') {
- g.performance = wxPerf;
- return;
- }
const start = Date.now();
g.performance = { now: (): number => Date.now() - start };
}