autonomous-ai/openharness/events-system
Claude Code and agent skill by autonomous-ai/openharness
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when working with the Phaser 4 event system. Covers EventEmitter, scene events, game events, custom events, and event-driven communication. Triggers on: events, on, emit, EventEmitter, scene events, listeners.
Install
npx vskill@latest install autonomous-ai/openharness/events-systemSKILL.md
The same SKILL.md was published earlier as phaserjs/phaser/events-system.
Events System
Phaser uses the EventEmitter pattern (via eventemitter3) throughout the entire framework. Every major system -- Game, Scene, Input, Loader, Cameras, Sound, Tweens, Physics, Textures, Animations -- is an EventEmitter or contains one. Events use lowercase string keys. Phaser provides named constants for all built-in events to avoid typos and enable IDE autocomplete.
Key source paths: src/events/EventEmitter.js, src/scene/events/, src/core/events/, src/input/events/, src/loader/events/, src/animations/events/, src/cameras/2d/events/, src/sound/events/, src/tweens/events/, src/physics/arcade/events/, src/textures/events/, src/gameobjects/events/, src/time/events/ Related skills: ../scenes/SKILL.md, ../input-keyboard-mouse-touch/SKILL.md
Quick Start
Using Named Constants (Preferred)
Core Concepts
EventEmitter Base Class
Phaser.Events.EventEmitter extends eventemitter3. It adds shutdown() and destroy() methods that both call removeAllListeners().
Full API (inherited from eventemitter3):
| Method | Description | |
|---|---|---|
on(event, fn, context?) | Add persistent listener. Returns this for chaining | |
addListener(event, fn, context?) | Alias for on | |
once(event, fn, context?) | Add one-time listener; auto-removed after first fire | |
off(event, fn?, context?, once?) | Remove listener(s). Must pass same fn reference to remove specific listener | |
removeListener(event, fn?, context?, once?) | Alias for off | |
removeAllListeners(event?) | Remove all listeners for event, or all events if no arg | |
emit(event, ...args) | Fire event. Returns true if it had listeners | |
listeners(event) | Return array of listener functions for an event | |
listenerCount(event) | Return number of listeners for an event | |
eventNames() | Return array of event names that have listeners | |
shutdown() | Calls removeAllListeners() | |
destroy() | Calls removeAllListeners() |
Event Strings vs Constants
Every built-in event is a lowercase string exported as a constant. The constant name maps predictably to the string:
Some events use a key-suffix pattern for per-key listening:
Context (Third Argument)
The third argument to on/once sets this inside the callback. Defaults to the emitter.
Common Patterns
Scene Lifecycle Events
Frame loop order: preupdate -> update -> Scene.update() -> postupdate -> prerender -> render
Game-Level Events
Inter-Scene Communication
Custom Events
All Event Namespaces Reference
Scene Events (Phaser.Scenes.Events)
Emitter: this.events (the Scene's Systems EventEmitter)
| Constant | String | When | |
|---|---|---|---|
BOOT | 'boot' | Scene Systems boot (for plugins) | |
READY | 'ready' | Scene Systems fully ready | |
START | 'start' | Scene starts running | |
CREATE | 'create' | After Scene.create() completes | |
PRE_UPDATE | 'preupdate' | Before update each frame | |
UPDATE | 'update' | Main update each frame | |
POST_UPDATE | 'postupdate' | After update each frame | |
PRE_RENDER | 'prerender' | Before render each frame | |
RENDER | 'render' | During render each frame | |
PAUSE | 'pause' | Scene paused | |
RESUME | 'resume' | Scene resumed from pause | |
SLEEP | 'sleep' | Scene put to sleep | |
WAKE | 'wake' | Scene woken from sleep | |
SHUTDOWN | 'shutdown' | Scene shutting down (may restart) | |
DESTROY | 'destroy' | Scene permanently destroyed | |
ADDED_TO_SCENE | 'addedtoscene' | GameObject added to scene | |
REMOVED_FROM_SCENE | 'removedfromscene' | GameObject removed from scene | |
TRANSITION_INIT | 'transitioninit' | Transition initialized (target scene) | |
TRANSITION_START | 'transitionstart' | Transition started (target scene) | |
TRANSITION_OUT | 'transitionout' | Transition out (source scene) | |
TRANSITION_COMPLETE | 'transitioncomplete' | Transition finished | |
TRANSITION_WAKE | 'transitionwake' | Transition wakes target scene |
Game Events (Phaser.Core.Events)
Emitter: this.game.events or game.events
| Constant | String | When | |
|---|---|---|---|
BOOT | 'boot' | Game instance finished booting | |
READY | 'ready' | Game ready to start running | |
SYSTEM_READY | 'systemready' | All global systems ready | |
PRE_STEP | 'prestep' | Before game loop step | |
STEP | 'step' | Main game loop step | |
POST_STEP | 'poststep' | After game loop step | |
PRE_RENDER | 'prerender' | Before rendering all scenes | |
POST_RENDER | 'postrender' | After rendering all scenes | |
PAUSE | 'pause' | Game paused | |
RESUME | 'resume' | Game resumed | |
BLUR | 'blur' | Browser tab lost focus | |
FOCUS | 'focus' | Browser tab gained focus | |
HIDDEN | 'hidden' | Page Visibility API: hidden | |
VISIBLE | 'visible' | Page Visibility API: visible | |
CONTEXT_LOST | 'contextlost' | WebGL context lost | |
DESTROY | 'destroy' | Game being destroyed |
Input Events (Phaser.Input.Events)
Emitter: this.input (scene-level) or individual GameObjects. Events exist at three levels: scene-level (this.input), scene-level with gameobject prefix, and directly on interactive GameObjects. See ../input-keyboard-mouse-touch/SKILL.md for full usage.
Scene-level pointer events (on `this.input`): POINTER_DOWN 'pointerdown' | POINTER_UP 'pointerup' | POINTER_MOVE 'pointermove' | POINTER_OVER 'pointerover' | POINTER_OUT 'pointerout' | POINTER_WHEEL 'wheel' | POINTER_DOWN_OUTSIDE 'pointerdownoutside' | POINTER_UP_OUTSIDE 'pointerupoutside'
Scene-level gameobject events (on `this.input`): GAMEOBJECT_DOWN 'gameobjectdown' | GAMEOBJECT_UP 'gameobjectup' | GAMEOBJECT_MOVE 'gameobjectmove' | GAMEOBJECT_OVER 'gameobjectover' | GAMEOBJECT_OUT 'gameobjectout' | GAMEOBJECT_WHEEL 'gameobjectwheel'
Per-GameObject events (emitted on the GameObject itself, requires `setInteractive()`): GAMEOBJECT_POINTER_DOWN 'pointerdown' | GAMEOBJECT_POINTER_UP 'pointerup' | GAMEOBJECT_POINTER_MOVE 'pointermove' | GAMEOBJECT_POINTER_OVER 'pointerover' | GAMEOBJECT_POINTER_OUT 'pointerout' | GAMEOBJECT_POINTER_WHEEL 'wheel'
Drag events (on `this.input` and on GameObjects with same string): DRAG_START/GAMEOBJECT_DRAG_START 'dragstart' | DRAG/GAMEOBJECT_DRAG 'drag' | DRAG_END/GAMEOBJECT_DRAG_END 'dragend' | DRAG_ENTER/GAMEOBJECT_DRAG_ENTER 'dragenter' | DRAG_OVER/GAMEOBJECT_DRAG_OVER 'dragover' | DRAG_LEAVE/GAMEOBJECT_DRAG_LEAVE 'dragleave' | DROP/GAMEOBJECT_DROP 'drop'
Other: GAME_OUT 'gameout' | GAME_OVER 'gameover' | POINTERLOCK_CHANGE 'pointerlockchange'
Loader Events (Phaser.Loader.Events)
Emitter: this.load
| Constant | String | When | |
|---|---|---|---|
ADD | 'addfile' | File added to load queue | |
START | 'start' | Loader starts | |
PROGRESS | 'progress' | Overall progress updated (0-1) | |
FILE_LOAD | 'load' | Individual file loaded | |
FILE_PROGRESS | 'fileprogress' | Individual file progress | |
FILE_COMPLETE | 'filecomplete' | Individual file completed processing | |
FILE_KEY_COMPLETE | 'filecomplete-' | Specific file completed (append type-key) | |
FILE_LOAD_ERROR | 'loaderror' | File failed to load | |
POST_PROCESS | 'postprocess' | All files loaded, post-processing | |
COMPLETE | 'complete' | All loading complete |
Animation Events (Phaser.Animations.Events)
Emitter: individual sprites (per-sprite) or this.anims (global AnimationManager)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingstore/agents/phaser/skills/events-system/SKILL.md
Popularity
- Repository stars
- 1,068
- Repository forks
- 89
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/autonomous-ai/openharness/events-system)