Open callumlocke opened 9 years ago
I should write this up somewhere, but here's as good as anywhere for now.
What skit does:
So the controller is re-instantiated in the client, and the skit-based modules there work the same as they do on the client (navigation/cookies/net), and as long as anything set on this (the controller) in preload is JSON serializable, everything will just work and be there in the client environment automatically.
But here's the caveat. "ish" means that eg. if you set something during preload that is instantiated from a custom class, skit won't do the right thing yet — because it doesn't know how to call the constructor to create that object. Skit just writes JSON and reads JSON back onto the controller for now.
I think I will need to add some kind of "serializable" interface to support serializing/deserializing custom classes, but I haven't done that yet.
(Another "ish" is that if you set other state in your various JS modules, that state will not be maintained — just the controller object gets the magic state transfer mechanism, for now. This is something else I'm thinking about improving.)
The blogpost and [homepage] both use the phrase "same-ish state".
Can you clarify why "ish"?