Skip to content

Commit 4b1da51

Browse files
committed
clarify callback is optional for flicker()
1 parent c5d50d6 commit 4b1da51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/melonjs/src/renderable/sprite.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export default class Sprite extends Renderable {
315315
/**
316316
* make the object flicker
317317
* @param {number} duration - expressed in milliseconds
318-
* @param {Function} callback - Function to call when flickering ends
318+
* @param {Function} [callback] - Function to call when flickering ends
319319
* @returns {Sprite} Reference to this object for method chaining
320320
* @example
321321
* // make the object flicker for 1 second
@@ -324,11 +324,11 @@ export default class Sprite extends Renderable {
324324
* world.removeChild(this);
325325
* });
326326
*/
327-
flicker(duration, callback) {
327+
flicker(duration, callback = undefined) {
328328
this._flicker.duration = duration;
329329
if (this._flicker.duration <= 0) {
330330
this._flicker.isFlickering = false;
331-
this._flicker.callback = null;
331+
this._flicker.callback = undefined;
332332
} else if (!this._flicker.isFlickering) {
333333
this._flicker.callback = callback;
334334
this._flicker.isFlickering = true;

0 commit comments

Comments
 (0)