Skip to main content

Memory

registerCustomSerializable

registerCustomSerializable lets you register your own pre-serialization and post-deserialization logic. This is necessary for objects with prototypes different than just Object.prototype or some other built-in prototypes like Map etc. Worklets can't handle such objects by default to convert into Serializables hence you need to register them as Custom Serializables. This way you can tell Worklets how to transfer your custom data structures between different Runtimes without manually serializing and deserializing them every time.