JSFiddle - React, Tailwind, and code Playground

by sdgluck

HTML

<script src="https://github.com/photonstorm/phaser/releases/download/v2.4.3/phaser.min.js"></script>

Babel + JSX

"use strict";

let game = new Phaser.Game(200, 200, Phaser.AUTO, 'example', {
    create: function() {
        game.stage.backgroundColor = '#000';
        
        var bmd = game.add.bitmapData(100, 100);
        bmd.context.fillStyle = '#fff';
    	bmd.context.fillRect(0, 0, 100, 100);
        game.cache.addBitmapData('button', bmd);
        
		let btn = new MyButton(game);
        // console.log(btn.onInputUp.dispatch());
    }
});

class MyButton extends Phaser.Button {
    constructor(game) {
        super(game, 50, 50, 'button', () => {
            this.clickHandler.apply(this, arguments);
        });
    }

    clickHandler() {
        console.log(arguments);
    }
}