Make DataView report window changes

Summary: Project: https://docs.google.com/document/d/1x-1ShlxXCM2od9JMO6PP14Cuqq0OrVe1Qd7FUwTos9A/edit

Reviewed By: antonk52

Differential Revision: D44748055

fbshipit-source-id: 409c272b12fb29c156efdaa1ab26d4d6a2936645
This commit is contained in:
Andrey Goncharov
2023-04-06 10:10:34 -07:00
committed by Facebook GitHub Bot
parent 4e898eb01a
commit ff85744911
3 changed files with 20 additions and 0 deletions

View File

@@ -83,6 +83,11 @@ type OutputChange =
// like: clear, filter or sorting change, etc
type: 'reset';
newCount: number;
}
| {
type: 'windowChange';
newStart: number;
newEnd: number;
};
export type DataSourceOptionKey<K extends PropertyKey> = {
@@ -582,6 +587,11 @@ export class DataSourceView<T, KeyType> {
public setWindow(start: number, end: number) {
this.windowStart = start;
this.windowEnd = end;
this.notifyAllListeners({
type: 'windowChange',
newStart: start,
newEnd: end,
});
}
public addListener(listener: (change: OutputChange) => void) {