Skip to content

Commit 3e1f6b4

Browse files
feat(gallery-web): create a DerivedLoaderController for gallery
1 parent 15e1ae0 commit 3e1f6b4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
type DerivedLoaderControllerSpec = {
2+
refreshIndicator: boolean;
3+
query: {
4+
isRefreshing: boolean;
5+
isSilentRefresh: boolean;
6+
};
7+
};
8+
9+
export class DerivedLoaderController {
10+
constructor(private spec: DerivedLoaderControllerSpec) {}
11+
12+
get isRefreshing(): boolean {
13+
const { isSilentRefresh, isRefreshing } = this.spec.query;
14+
15+
return !isSilentRefresh && isRefreshing;
16+
}
17+
18+
get showRefreshIndicator(): boolean {
19+
if (!this.spec.refreshIndicator) {
20+
return false;
21+
}
22+
23+
return this.isRefreshing;
24+
}
25+
}

0 commit comments

Comments
 (0)