glenjamin / transit-immutable-js

Transit serialisation for Immutable.js
MIT License
250 stars 31 forks source link

Extensibility for other types #30

Closed gusvargas closed 7 years ago

gusvargas commented 7 years ago

I would love to make transit work with the EditorState immutable record from Facebook's draft-js. However, the serialization/deserialization semantics are a bit different from a regular run-of-the-mill record, i.e., draft-js#convertToRaw, draft-js#convertFromRaw.

It's easy enough to write a new reader/writer for EditorState but I'm wondering what's the extensibility story in transit-js? How can I have one reader/writer that is augmented by transit-immutable-js, other OS libs, and my own handlers? Right now I'm essentially going to fork this project to add the other types that I care about.

This seems to be the only extension of transit-js so I'm not quite sure what's the "right way" of providing extension points. Perhaps, this lib can also just export the reader/writer handlers?

Thanks for putting this together btw – it's been really handy.

glenjamin commented 7 years ago

I'm closing this as a duplicate of #29 - it's definitely something worth having.

I hadn't considered exporting the reader/writer handlers - that makes a lot of sense. I might do that in addition to the other way around where this lib accepts additional handlers.

gusvargas commented 7 years ago

Ah sorry I must have missed that issue.