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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
chore(sdk): the lifecycle's host path states its contract, and the snapshot names the new seams
esengine8dafa4019e5c
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex de0c35380..57cf644c2 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -5015,9 +5015,11 @@ hideLoading: (() => void) | undefinedloadSubpackage: ((opts: { name: string; success?: () => void; fail?: (err: unknown) => void; complete?: () => void; }) => void) | undefinedlogin: ((opts: { success?: (res: { code: string; }) => void; fail?: (err: unknown) => void; timeout?: number; }) => void) | undefinedoffError: ((cb: (error: string | { message?: string; stack?: string; }) => void) => void) | undefined+offHide: ((cb: () => void) => void) | undefinedoffKeyDown: ((cb: (res: MiniGameKeyEvent) => void) => void) | undefinedoffKeyUp: ((cb: (res: MiniGameKeyEvent) => void) => void) | undefinedoffMemoryWarning: ((cb: () => void) => void) | undefined+offShow: ((cb: () => void) => void) | undefinedoffTouchCancel: ((cb: (res: MiniGameTouchEvent) => void) => void) | undefinedoffTouchEnd: (cb: (res: MiniGameTouchEvent) => void) => voidoffTouchMove: (cb: (res: MiniGameTouchEvent) => void) => void@@ -5107,6 +5109,8 @@ loadSubpackage: (name: string) => Promise<void>login: () => Promise<string>name: PlatformNamenow: () => number+onAppHide: (callback: () => void) => () => void+onAppShow: (callback: () => void) => () => voidonMemoryWarning: (callback: () => void) => () => voidonShareRequest: (provide: () => PlatformShareOptions) => voidonUnhandledError: (callback: (error: unknown) => void) => () => voiddiff --git a/sdk/src/ecs/lifecycle.ts b/sdk/src/ecs/lifecycle.tsindex bc79912ab..7462d8139 100644--- a/sdk/src/ecs/lifecycle.ts+++ b/sdk/src/ecs/lifecycle.ts@@ -181,11 +181,9 @@ function setupWebLifecycle_(manager: LifecycleManager, app: AppLike): () => void// =============================================================================/**- * No DOM visibility event: the host pushes foreground/background through the- * platform adapter (a mini-game's onShow/onHide, the native bridge). On native- * the audio device is suspended by the host directly on background — correct- * even while the JS tick is paused — so this only drives the game tick and the- * lifecycle events.+ * The host pushes foreground/background through the adapter (a mini-game's+ * onShow/onHide, the native bridge). Native suspends audio itself on background,+ * so this only drives the game tick and the lifecycle events.*/function setupHostLifecycle_(manager: LifecycleManager, app: AppLike): () => void {let pausedByLifecycle = false;diff --git a/sdk/tests/minigame-lifecycle.test.ts b/sdk/tests/minigame-lifecycle.test.tsindex 9d8616372..f5d7209cf 100644--- a/sdk/tests/minigame-lifecycle.test.ts+++ b/sdk/tests/minigame-lifecycle.test.ts@@ -4,9 +4,8 @@* @file Lifecycle on a mini-game host that is not WeChat.** Every mini-game runs with a `document` stub (wxgame-pre.js) that has no- * addEventListener. The plugin used to branch on the vendor name, so any other- * vendor fell through to the web path and threw at boot — which is how a vivo- * quick game first died on an emulator. The host's own onShow/onHide drive it.+ * addEventListener, so the web path must never be taken from one; the host's+ * own onShow/onHide drive it, whichever vendor it is.*/import { describe, it, expect, afterEach } from 'vitest';import { App } from '../src/app/app';