From ce4ef80d995133a6bcdf44534bb0339c9ba79b4c Mon Sep 17 00:00:00 2001 From: bagel786 Date: Sat, 29 Aug 2026 12:05:29 -0500 Subject: [PATCH] Fix BaseTween callback types --- scripts/tsgen/test/src/game.ts | 9 +++++++++ src/tweens/tween/BaseTween.js | 2 +- src/tweens/typedefs/TweenCallbacks.js | 28 +++++++++++++++++---------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/scripts/tsgen/test/src/game.ts b/scripts/tsgen/test/src/game.ts index d8b108110c..09b56c7080 100644 --- a/scripts/tsgen/test/src/game.ts +++ b/scripts/tsgen/test/src/game.ts @@ -336,6 +336,15 @@ class BootScene extends Phaser.Scene { tween.stop(); tween.remove(); + let callbacks: Record = tween.callbacks; + let onCompleteCallback = callbacks.onComplete; + + if (onCompleteCallback) + { + let callback: Function = onCompleteCallback.func; + let callbackParams: any[] = onCompleteCallback.params; + } + // Tween chain let chain = this.tweens.chain({ targets: sprite, diff --git a/src/tweens/tween/BaseTween.js b/src/tweens/tween/BaseTween.js index 6b26600ea5..226c6e2637 100644 --- a/src/tweens/tween/BaseTween.js +++ b/src/tweens/tween/BaseTween.js @@ -193,7 +193,7 @@ var BaseTween = new Class({ this.paused = false; /** - * An object containing the different Tween callback functions. + * An object containing the different Tween callback handlers. * * You can either set these in the Tween config, or by calling the `Tween.setCallback` method. * diff --git a/src/tweens/typedefs/TweenCallbacks.js b/src/tweens/typedefs/TweenCallbacks.js index 069f07ad1c..cbe4632ca9 100644 --- a/src/tweens/typedefs/TweenCallbacks.js +++ b/src/tweens/typedefs/TweenCallbacks.js @@ -1,15 +1,23 @@ +/** + * @typedef {object} Phaser.Types.Tweens.TweenCallbackData + * @since 4.3.0 + * + * @property {function} func - The callback function. + * @property {array} params - Additional parameters to pass to the callback. + */ + /** * @typedef {object} Phaser.Types.Tweens.TweenCallbacks * @since 3.60.0 * - * @property {Phaser.Types.Tweens.TweenOnActiveCallback} [onActive] - A function to call when the tween becomes active within the Tween Manager. - * @property {Phaser.Types.Tweens.TweenOnStartCallback} [onStart] - A function to call when the tween starts playback, after any delays have expired. - * @property {Phaser.Types.Tweens.TweenOnCompleteCallback} [onComplete] - A function to call when the tween completes. - * @property {Phaser.Types.Tweens.TweenOnLoopCallback} [onLoop] - A function to call each time the tween loops. - * @property {Phaser.Types.Tweens.TweenOnPauseCallback} [onPause] - A function to call each time the tween is paused. - * @property {Phaser.Types.Tweens.TweenOnResumeCallback} [onResume] - A function to call each time the tween is resumed. - * @property {Phaser.Types.Tweens.TweenOnRepeatCallback} [onRepeat] - A function to call each time the tween repeats. Called once per property per target. - * @property {Phaser.Types.Tweens.TweenOnStopCallback} [onStop] - A function to call when the tween is stopped. - * @property {Phaser.Types.Tweens.TweenOnUpdateCallback} [onUpdate] - A function to call each time the tween steps. Called once per property per target. - * @property {Phaser.Types.Tweens.TweenOnYoyoCallback} [onYoyo] - A function to call each time the tween yoyos. Called once per property per target. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onActive - The `onActive` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onStart - The `onStart` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onComplete - The `onComplete` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onLoop - The `onLoop` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onPause - The `onPause` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onResume - The `onResume` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onRepeat - The `onRepeat` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onStop - The `onStop` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onUpdate - The `onUpdate` callback handler, or `null` if it has not been set. + * @property {?Phaser.Types.Tweens.TweenCallbackData} onYoyo - The `onYoyo` callback handler, or `null` if it has not been set. */