Provide a new interface for generic vm

This commit is contained in:
R Midhun Suresh 2025-07-26 18:28:17 +05:30
parent d384a9b71b
commit 23a2785223
No known key found for this signature in database

View File

@ -21,3 +21,20 @@ export interface ViewModel<T> {
*/
subscribe: (listener: () => void) => () => void;
}
/**
* The interface for a generic ViewModel passed to the shared components.
*/
export interface ViewModelNew {
/**
* Subscribes to changes in the view model.
* ViewModel will invoke the callback when the UI needs to be updated.
*/
subscribe: (callback: () => void) => () => void;
/**
* React uses the return value of this method to determine if it needs to
* re-render the component.
*/
getSnapshot: () => unknown;
}