hydrate.ts 595 B

12345678910111213141516
  1. import "./hydrate_types";
  2. import { HydrationCallback } from "./hydrate_types";
  3. export function register_rehydrate_chunk_for_streaming(callback: HydrationCallback): void {
  4. return register_rehydrate_chunk_for_streaming_debug(callback);
  5. }
  6. export function register_rehydrate_chunk_for_streaming_debug(
  7. callback: HydrationCallback
  8. ): void {
  9. window.hydration_callback = callback;
  10. for (let i = 0; i < window.hydrate_queue.length; i++) {
  11. const [id, data, debug_types, debug_locations] = window.hydrate_queue[i];
  12. window.hydration_callback(id, data, debug_types, debug_locations);
  13. }
  14. }