| 38 | private contract: EventContractDetails = inject(JSACTION_EVENT_CONTRACT); |
| 39 | |
| 40 | add(blockId: string, info: DehydratedDeferBlock) { |
| 41 | this.registry.set(blockId, info); |
| 42 | // It's possible that hydration is queued that's waiting for the |
| 43 | // resolution of a lazy loaded route. In this case, we ensure |
| 44 | // the callback function is called to continue the hydration process |
| 45 | // for the queued block set. |
| 46 | if (this.awaitingCallbacks.has(blockId)) { |
| 47 | const awaitingCallbacks = this.awaitingCallbacks.get(blockId)!; |
| 48 | for (const cb of awaitingCallbacks) { |
| 49 | cb(); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | get(blockId: string): DehydratedDeferBlock | null { |
| 55 | return this.registry.get(blockId) ?? null; |