Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/tsgen/test/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@ class BootScene extends Phaser.Scene {
tween.stop();
tween.remove();

let callbacks: Record<Phaser.Types.Tweens.TweenCallbackTypes, { func: Function; params: any[] } | null> = 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,
Expand Down
2 changes: 1 addition & 1 deletion src/tweens/tween/BaseTween.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
28 changes: 18 additions & 10 deletions src/tweens/typedefs/TweenCallbacks.js
Original file line number Diff line number Diff line change
@@ -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.
*/