JSFiddle - React, Tailwind, and code Playground

by joplomacedo

JavaScript

const GameHandlerFactory = {

	
	build( League ) {
		const instances = {}
		
		 return class _GameHandler {
			constructor(id) {
                const GH = new GameHandler(id);
				instances['a'] = GH;
				return GH;
            }
            
            static print() {
				instances['a'].print();
            }
		}
	}
};

class GameHandler {
    constructor(id) {
    }

    print( ) {
       console.log(3);
    }
	
}


const GH = GameHandlerFactory.build();
const gh = new GH();

GH.print();