@sigil-dev/runtime 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +14 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -452,3 +452,17 @@ export function setContext<T>(key: ContextKey<T>, value: T): void {
|
|
|
452
452
|
export function getContext<T>(key: ContextKey<T>): T {
|
|
453
453
|
return getStore().get(key as unknown as symbol) as T;
|
|
454
454
|
}
|
|
455
|
+
|
|
456
|
+
const _hydrationStack: ChildNode[][] = [];
|
|
457
|
+
|
|
458
|
+
export function pushHydrationNodes(nodes: ChildNode[]): void {
|
|
459
|
+
_hydrationStack.push(nodes);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export function popHydrationNodes(): void {
|
|
463
|
+
_hydrationStack.pop();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export function getHydrationNodes(): ChildNode[] {
|
|
467
|
+
return _hydrationStack[_hydrationStack.length - 1] ?? [];
|
|
468
|
+
}
|