I want to expose a class (to other JS code, which may not be written in Haxe) and I want the constructor to accept an options object. So, the external JS code might look something like this:
chessGame = new ChessGame({
"difficulty": 100,
"timeLimit": 60
});
In my Haxe code, I’ve exposed the class and tried defining the constructor like this:
public function new(options:Map<String, Int>) {
trace(options); // Also tried options.toString()
}
The result of the trace
is an empty object. What am I missing, or, how else could I approach this?
tl;dr → want to expose a class to be used by external JS code, and I want the constructor (and potentially other methods) to accept an object/map of settings/config data.