blob: d37dc84646b1455cf73a9e95a29490a0065df9c9 [file] [log] [blame]
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02001import {
2 ScriptEnvironment,
3 ScriptPage,
4 ScriptRunPhase,
5} from '../../../common/architecture/scripts/Script';
6import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript';
7import CCInfiniteScroll from '../core/ccInfiniteScroll';
8import CCInfiniteScrollLoadMoreBarHandler from '../nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler';
9import CCInfiniteScrollLoadMoreBtnHandler from '../nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler';
10import CCInfiniteScrollSetUpHandler from '../nodeWatcherHandlers/ccInfiniteScrollSetUp.handler';
11
12export interface InfiniteScrollNodeWatcherOptions {
13 ccInfiniteScroll: CCInfiniteScroll;
14}
15
16export default class CCInfiniteScrollScript extends NodeWatcherScript<InfiniteScrollNodeWatcherOptions> {
17 page = ScriptPage.CommunityConsole;
18 environment = ScriptEnvironment.ContentScript;
19 runPhase = ScriptRunPhase.Main;
20 handlers = new Map([
21 ['ccInfiniteScrollSetUp', CCInfiniteScrollSetUpHandler],
22 ['ccInfiniteScrollLoadMoreBar', CCInfiniteScrollLoadMoreBarHandler],
23 ['ccInfiniteScrollLoadMoreBtn', CCInfiniteScrollLoadMoreBtnHandler],
24 ]);
25
26 protected optionsFactory(): InfiniteScrollNodeWatcherOptions {
27 return {
28 ccInfiniteScroll: new CCInfiniteScroll(),
29 };
30 }
31}