Update:
I have converted the class to a phaser plugin so now it can be installed once and used in any scene.
import phaserJuice from ".path/to/phaserJuicePlugin.min.js";
const config = {
type: Phaser.AUTO,
width: 480,
height: 400,
parent: "gameCanvas",
plugins: {
scene: [
{ key: 'phaserJuice', plugin: phaserJuice, mapping: 'juice' }
]
},
scene: basicScene,
};
const game = new Phaser.Game(config);
// you can now access the plugin in any scene using
this.juice