-
Can you customize the deserialization of an enum?
-
Can you implement methods for enums?
-
Can you implement methods for foreign types? (e.g. can I add an
inline
method tojs.html.CanvasElement
objects?)
- Assuming you’re using
haxe.Unserializer
, not really. - Static Extension (Language Features) - Haxe - The Cross-platform Toolkit
- Static Extension (Language Features) - Haxe - The Cross-platform Toolkit
(Note that static extension is purely compile time syntax sugar, it simply transforms x.staticExtension()
into pack.Class.staticExtension(x)
)
1 Like
Thanks for the quick answer
My Haxe application is consuming a JSON API … I would like to serialize / deserialize some part of it from/into a Haxe enum.
Thanks, static extensions are exactly what I was looking for!
- Yes. Try tink_json or json2object or haxe.Serializer
- Yes. Try adding
@:using
to your enum - Yes. You can add inline functions to extern.
3 Likes