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.

fix: resolve CI failures from Audio fadeAnimId_ rename and TS deprecation

esengine92bb4e4fa265
diff --git a/sdk/src/audio/Audio.ts b/sdk/src/audio/Audio.ts
index 1ad9ba159..c9d39ed3d 100644
--- a/sdk/src/audio/Audio.ts
+++ b/sdk/src/audio/Audio.ts
@@ -94,10 +94,10 @@ export class Audio {
crossFade?: number;
}): void {
const play = (buffer: AudioBufferHandle) => {
- if (this.fadeAnimId_) {
- cancelAnimationFrame(this.fadeAnimId_);
- this.fadeAnimId_ = 0;
+ for (const id of this.fadeAnimIds_) {
+ cancelAnimationFrame(id);
}
+ this.fadeAnimIds_.clear();
const targetVolume = config?.volume ?? 1.0;
const oldVolume = this.bgmVolume_;
@@ -138,10 +138,10 @@ export class Audio {
}
static stopAll(): void {
- if (this.fadeAnimId_) {
- cancelAnimationFrame(this.fadeAnimId_);
- this.fadeAnimId_ = 0;
+ for (const id of this.fadeAnimIds_) {
+ cancelAnimationFrame(id);
}
+ this.fadeAnimIds_.clear();
if (this.bgmHandle_) {
this.bgmHandle_.stop();
this.bgmHandle_ = null;
@@ -150,10 +150,10 @@ export class Audio {
static stopBGM(fadeOut?: number): void {
if (!this.bgmHandle_) return;
- if (this.fadeAnimId_) {
- cancelAnimationFrame(this.fadeAnimId_);
- this.fadeAnimId_ = 0;
+ for (const id of this.fadeAnimIds_) {
+ cancelAnimationFrame(id);
}
+ this.fadeAnimIds_.clear();
if (fadeOut && fadeOut > 0) {
const handle = this.bgmHandle_;
this.bgmHandle_ = null;
diff --git a/sdk/tsconfig.json b/sdk/tsconfig.json
index 9637731eb..42ba92eb0 100644
--- a/sdk/tsconfig.json
+++ b/sdk/tsconfig.json
@@ -10,6 +10,7 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
+ "ignoreDeprecations": "5.0",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,