Last change
on this file since b738035 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago |
adding photos
|
-
Property mode
set to
100644
|
File size:
3.7 KB
|
Line | |
---|
1 | import { DomHandler } from './domhandler';
|
---|
2 | export class ConnectedOverlayScrollHandler {
|
---|
3 | constructor(element, listener = () => { }) {
|
---|
4 | this.element = element;
|
---|
5 | this.listener = listener;
|
---|
6 | }
|
---|
7 | bindScrollListener() {
|
---|
8 | this.scrollableParents = DomHandler.getScrollableParents(this.element);
|
---|
9 | for (let i = 0; i < this.scrollableParents.length; i++) {
|
---|
10 | this.scrollableParents[i].addEventListener('scroll', this.listener);
|
---|
11 | }
|
---|
12 | }
|
---|
13 | unbindScrollListener() {
|
---|
14 | if (this.scrollableParents) {
|
---|
15 | for (let i = 0; i < this.scrollableParents.length; i++) {
|
---|
16 | this.scrollableParents[i].removeEventListener('scroll', this.listener);
|
---|
17 | }
|
---|
18 | }
|
---|
19 | }
|
---|
20 | destroy() {
|
---|
21 | this.unbindScrollListener();
|
---|
22 | this.element = null;
|
---|
23 | this.listener = null;
|
---|
24 | this.scrollableParents = null;
|
---|
25 | }
|
---|
26 | }
|
---|
27 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29ubmVjdGVkb3ZlcmxheXNjcm9sbGhhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvZG9tL2Nvbm5lY3RlZG92ZXJsYXlzY3JvbGxoYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxVQUFVLEVBQUMsTUFBTSxjQUFjLENBQUM7QUFFeEMsTUFBTSxPQUFPLDZCQUE2QjtJQVF0QyxZQUFZLE9BQVksRUFBRSxXQUFnQixHQUFHLEVBQUUsR0FBRSxDQUFDO1FBQzlDLElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyx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AgIH1cbiAgICB9XG5cbiAgICBkZXN0cm95KCkge1xuICAgICAgICB0aGlzLnVuYmluZFNjcm9sbExpc3RlbmVyKCk7XG4gICAgICAgIHRoaXMuZWxlbWVudCA9IG51bGw7XG4gICAgICAgIHRoaXMubGlzdGVuZXIgPSBudWxsO1xuICAgICAgICB0aGlzLnNjcm9sbGFibGVQYXJlbnRzID0gbnVsbDtcbiAgICB9XG59XG4iXX0= |
---|
Note:
See
TracBrowser
for help on using the repository browser.