Adrià Vilanova Martínez | 43c7520 | 2024-10-19 15:55:15 +0200 | [diff] [blame^] | 1 | import { NodeMutation } from '../../../presentation/nodeWatcher/NodeWatcherHandler'; |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 2 | import CssSelectorNodeWatcherScriptHandler from '../../../common/architecture/scripts/nodeWatcher/handlers/CssSelectorNodeWatcherScriptHandler'; |
| 3 | import { InfiniteScrollNodeWatcherOptions } from '../scripts/ccInfiniteScroll.script'; |
| 4 | |
| 5 | export default class CCInfiniteScrollLoadMoreBarHandler extends CssSelectorNodeWatcherScriptHandler<InfiniteScrollNodeWatcherOptions> { |
| 6 | cssSelector = '.load-more-bar'; |
| 7 | |
| 8 | onMutatedNode({ node }: NodeMutation) { |
Adrià Vilanova Martínez | d45c04e | 2024-06-02 19:13:38 +0200 | [diff] [blame] | 9 | if (!(node instanceof Element)) { |
| 10 | console.error( |
| 11 | '[CCInfiniteScrollLoadMoreBarHandler] Node is not an Element: ', |
| 12 | node, |
| 13 | ); |
| 14 | return; |
| 15 | } |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 16 | this.options.ccInfiniteScroll.observeLoadMoreBar(node); |
| 17 | } |
| 18 | } |