zth / rescript-relay-router

MIT License
16 stars 3 forks source link

Translate stream asset containers to callbacks #41

Closed Kingdutch closed 2 years ago

Kingdutch commented 2 years ago

This introduces a new PreloadInsertingStream class which takes care of writing assets into the React stream.

The stream class has a bunch of callback methods that can be used by other code to add assets into the stream. This replaces a shared object that was used before and relied on how shared object references work in JavaScript which can be a bit more finicky. An added benefit is that our callbacks rely on function signatures rather than object shapes so their API is better defined.