@cratis/event-models 0.264.0 → 0.264.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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** What watches one element, and the element it watches. */
|
|
2
|
+
export interface Watching<T> {
|
|
3
|
+
root: T;
|
|
4
|
+
stop: () => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Decides what watches the element on a render: the element may not exist yet (a child's first layout effect runs before the ref of the element around it is set),
|
|
8
|
+
* so every render looks again - nothing starts until the element is there, one watcher is kept while it is the same element, and a replaced element is
|
|
9
|
+
* watched anew with the old watcher stopped.
|
|
10
|
+
*
|
|
11
|
+
* @param current What watched the element before, if anything.
|
|
12
|
+
* @param root The element now, if it exists.
|
|
13
|
+
* @param start Starts watching an element; returns what stops it.
|
|
14
|
+
* @returns What watches the element now.
|
|
15
|
+
*/
|
|
16
|
+
export declare function keepWatching<T>(current: Watching<T> | undefined, root: T | null | undefined, start: (root: T) => () => void): Watching<T> | undefined;
|