Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let scrolled;
- let div = this.template.querySelector(".resultsscroll");
- div.onscroll = function() {
- scrolled = true;
- }
- let scrollIntervalId = setInterval(() => {
- if (scrolled) {
- scrolled = false;
- if (this.aThingINeed && div.scrollHeight - div.scrollTop < 300) {
- // do stuff
- }
- }
- }, 750);
- this.scrollIntervalId = scrollIntervalId;
- afterRender : function(component, helper, event) {
- this.superAfterRender();
- let scrolled;
- let div = component.find('resultsscroll');
- if (!$A.util.isEmpty(div)) {
- div = div.getElement();
- div.onscroll = () => scrolled = true;
- let scrollIntervalId = setInterval($A.getCallback(() => {
- if (scrolled) {
- scrolled = false;
- if (component.get("v.aThingINeed") && div.scrollHeight - div.scrollTop < 300) {
- // do stuff
- }
- }
- }), 750);
- component.set('v.scrollIntervalId', scrollIntervalId);
- }
- },
- unrender: function( component, helper ) {
- this.superUnrender();
- window.clearInterval(component.get("v.scrollIntervalId"));
- }
Add Comment
Please, Sign In to add comment