tsphillips Posted November 9, 2014 Share Posted November 9, 2014 Is there a place (or places) that documents all possible callbacks and their signatures? For example, the onInputDown() documentation (http://docs.phaser.io/Phaser.Events.html#onInputDown) references the Signal class, which has an add() method (http://docs.phaser.io/Phaser.Signal.html#add). However, I can't find anything other than ad hoc examples on the web describing the expected signature of a listener (function). I expect that different event types imply different listener functions, but I haven't been able to find any reference documentation describing this. Also, I'm not sure where the best place for such documentation would be. For now, I am using the below grep as a reference. I'm assuming the dispatch functions roughly match the callback signatures. If I'm off track, could someone steer me in the right direction?animation/Animation.js:206: this._parent.events.onAnimationStart.dispatch(this._parent, this);animation/Animation.js:208: this.onStart.dispatch(this._parent, this);animation/Animation.js:235: this.onStart.dispatch(this._parent, this);animation/Animation.js:322: this._parent.events.onAnimationComplete.dispatch(this._parent, this);animation/Animation.js:323: this.onComplete.dispatch(this._parent, this);animation/Animation.js:396: this._parent.events.onAnimationLoop.dispatch(this._parent, this);animation/Animation.js:397: this.onLoop.dispatch(this._parent, this);animation/Animation.js:419: this.onUpdate.dispatch(this, this.currentFrame);animation/Animation.js:473: this.onUpdate.dispatch(this, this.currentFrame);animation/Animation.js:522: this.onUpdate.dispatch(this, this.currentFrame);animation/Animation.js:581: this._parent.events.onAnimationComplete.dispatch(this._parent, this);animation/Animation.js:583: this.onComplete.dispatch(this._parent, this);animation/Animation.js:673: this.onUpdate.dispatch(this, this.currentFrame);core/Game.js:793: this.onPause.dispatch(event);core/Game.js:814: this.onResume.dispatch(event);core/Game.js:828: this.onBlur.dispatch(event);core/Game.js:846: this.onFocus.dispatch(event);core/Game.js:880: this.onPause.dispatch(this);core/Game.js:892: this.onResume.dispatch(this);core/Group.js:226: child.events.onAddedToGroup.dispatch(child, this);core/Group.js:290: child.events.onAddedToGroup.dispatch(child, this);core/Group.js:356: child.events.onAddedToGroup.dispatch(child, this);core/Group.js:651: newChild.events.onRemovedFromGroup.dispatch(newChild, this);core/Group.js:1632: child.events.onRemovedFromGroup.dispatch(child, this);core/Group.js:1675: this.children[0].events.onRemovedFromGroup.dispatch(this.children[0], this);core/Group.js:1722: this.children[i].events.onRemovedFromGroup.dispatch(this.children[i], this);core/Group.js:1758: this.onDestroy.dispatch(this, destroyChildren, soft);core/ScaleManager.js:606: this.leaveIncorrectOrientation.dispatch();core/ScaleManager.js:620: this.enterIncorrectOrientation.dispatch();core/ScaleManager.js:644: this.enterLandscape.dispatch(this.orientation, true, false);core/ScaleManager.js:648: this.enterPortrait.dispatch(this.orientation, false, true);core/ScaleManager.js:682: this.enterPortrait.dispatch(this.orientation, false, true);core/ScaleManager.js:686: this.enterIncorrectOrientation.dispatch();core/ScaleManager.js:690: this.leaveIncorrectOrientation.dispatch();core/ScaleManager.js:696: this.enterLandscape.dispatch(this.orientation, true, false);core/ScaleManager.js:700: this.leaveIncorrectOrientation.dispatch();core/ScaleManager.js:704: this.enterIncorrectOrientation.dispatch();core/ScaleManager.js:1058: this.enterFullScreen.dispatch(this.width, this.height);core/ScaleManager.js:1074: this.leaveFullScreen.dispatch(this.width, this.height);gameobjects/Button.js:487: this.onInputOver.dispatch(this, pointer);gameobjects/Button.js:514: this.onInputOut.dispatch(this, pointer);gameobjects/Button.js:540: this.onInputDown.dispatch(this, pointer);gameobjects/Button.js:561: this.onInputUp.dispatch(this, pointer, isOver);gameobjects/Image.js:479: this.events.onRevived.dispatch(this);gameobjects/Image.js:504: this.events.onKilled.dispatch(this);gameobjects/Image.js:529: this.events.onDestroy.dispatch(this);gameobjects/Rope.js:216: this.events.onEnterBounds.dispatch(this);gameobjects/Rope.js:222: this.events.onOutOfBounds.dispatch(this);gameobjects/Rope.js:418: this.events.onDestroy.dispatch(this);gameobjects/Sprite.js:265: this.events.onEnterBounds.dispatch(this);gameobjects/Sprite.js:271: this.events.onOutOfBounds.dispatch(this);gameobjects/Sprite.js:602: this.events.onRevived.dispatch(this);gameobjects/Sprite.js:627: this.events.onKilled.dispatch(this);gameobjects/Sprite.js:652: this.events.onDestroy.dispatch(this);gameobjects/Text.js:241: this.events.onDestroy.dispatch(this);gameobjects/TileSprite.js:222: this.events.onEnterBounds.dispatch(this);gameobjects/TileSprite.js:228: this.events.onOutOfBounds.dispatch(this);gameobjects/TileSprite.js:451: this.events.onDestroy.dispatch(this);input/GamepadButton.js:112: this.onDown.dispatch(this, value);input/GamepadButton.js:130: this.onUp.dispatch(this, value);input/GamepadButton.js:145: this.onFloat.dispatch(this, value);input/InputHandler.js:859: this.sprite.events.onInputOver.dispatch(this.sprite, pointer);input/InputHandler.js:892: this.sprite.events.onInputOut.dispatch(this.sprite, pointer);input/InputHandler.js:924: this.sprite.events.onInputDown.dispatch(this.sprite, pointer);input/InputHandler.js:975: this.sprite.events.onInputUp.dispatch(this.sprite, pointer, true);input/InputHandler.js:983: this.sprite.events.onInputUp.dispatch(this.sprite, pointer, false);input/InputHandler.js:1290: this.sprite.events.onDragStart.dispatch(this.sprite, pointer);input/InputHandler.js:1354: this.sprite.events.onDragStop.dispatch(this.sprite, pointer);input/Key.js:162: this.onDown.dispatch(this);input/Key.js:188: this.onUp.dispatch(this);input/Mouse.js:494: this.pointerLock.dispatch(true, event);input/Mouse.js:500: this.pointerLock.dispatch(false, event);input/Pointer.js:299: this.game.input.onDown.dispatch(this, event);input/Pointer.js:343: this.game.input.onHold.dispatch(this);input/Pointer.js:592: this.game.input.onUp.dispatch(this, event);input/Pointer.js:601: this.game.input.onTap.dispatch(this, true);input/Pointer.js:606: this.game.input.onTap.dispatch(this, false);loader/Cache.js:567: this.onSoundUnlock.dispatch(key);loader/Loader.js:991: this.onLoadStart.dispatch(this._fileList.length);loader/Loader.js:1005: this.onLoadComplete.dispatch();loader/Loader.js:1158: this.onFileError.dispatch(this._packList[index].key, this._packList[index]);loader/Loader.js:1174: this.onPackComplete.dispatch(this._packList[index].key, success, this.totalLoadedPacks(), this._packList.length);loader/Loader.js:1206: this.onFileStart.dispatch(this.progress, file.key, file.url);loader/Loader.js:1420: this.onFileError.dispatch(this._fileList[index].key, this._fileList[index]);loader/Loader.js:1518: that.game.sound.onSoundDecode.dispatch(key, that.game.cache.getSound(key));loader/Loader.js:1756: this.onFileComplete.dispatch(this.progress, this._fileList[previousIndex].key, success, this.totalLoadedFiles(), this._fileList.length);loader/Loader.js:1770: this.onLoadComplete.dispatch();sound/Sound.js:383: this.onDecoded.dispatch(this);sound/Sound.js:404: this.onLoop.dispatch(this);sound/Sound.js:413: this.onMarkerComplete.dispatch(this.currentMarker, this);sound/Sound.js:426: this.onLoop.dispatch(this);sound/Sound.js:586: this.onPlay.dispatch(this);sound/Sound.js:635: this.onPlay.dispatch(this);sound/Sound.js:680: this.onPause.dispatch(this);sound/Sound.js:734: this.onResume.dispatch(this);sound/Sound.js:777: this.onMarkerComplete.dispatch(this.currentMarker, this);sound/Sound.js:784: this.onStop.dispatch(this, prevMarker);sound/Sound.js:866: this.onFadeComplete.dispatch(this, this.volume);sound/Sound.js:985: this.onMute.dispatch(this);sound/SoundManager.js:309: that.onSoundDecode.dispatch(key, sound);time/Timer.js:464: this.onComplete.dispatch(this);tween/Tween.js:692: this.onStart.dispatch(this._object);tween/Tween.js:770: this.onLoop.dispatch(this._object);tween/Tween.js:777: this.onComplete.dispatch(this._object);Tom Link to comment Share on other sites More sharing options...
rich Posted November 9, 2014 Share Posted November 9, 2014 The dispatch calls listed above don't roughly match the signatures; they exactly match them! The parameters are never morphed beyond what you've listed out above and are rarely conditional either. Tilde 1 Link to comment Share on other sites More sharing options...
tsphillips Posted November 10, 2014 Author Share Posted November 10, 2014 You have dispelled my uncertainty. Thanks! Tom Link to comment Share on other sites More sharing options...
hayesmaker Posted October 23, 2015 Share Posted October 23, 2015 Are those signatures somehow available in the docs? if we pass custom arguments it's quite fiddly to know how many default params we have to setup in our listeners before we find our custom args. Link to comment Share on other sites More sharing options...
glantucan Posted January 10, 2016 Share Posted January 10, 2016 I agree with hayesmaker, it's a pain to get this information from the source code. It would be very nice to have it on the documentation. Link to comment Share on other sites More sharing options...
Recommended Posts