JS doesn’t natively allow haxe enums, maps etc be passed to/from webworkers, due to the restrictions in the structured cloning algorithm. (The structured clone algorithm - Web APIs | MDN)
So, haxe objects containing enums have to be “serialized” to simple javascript objects containing only object literals (no functions etc…) Elnabo’s json2object json2object (3.9.0) (based on Nadako’s GitHub - nadako/hxjsonast: Parse JSON into position-aware AST with Haxe!) is my goto solution for serializing haxe objects to plain json and back, but this solution (of course) results in a json string, not an object.
Someone know of a lightweight and quick object translator around that can convert a haxe object to/from a simple js object that can be handled by the structured clone algorithm?
Other ideas?
// Jonas