Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scheduleOnce('afterRender', this, () => {
// grab the user added callbacks when we enter/leave the element
const {
enterCallback = noop,
exitCallback = noop
} = this.getCallbacks(element) || {};
// this isn't using the same functions as the mixin case, but that is b/c it is a bit harder to unwind.
// So just rewrote it with pure functions for now
startRAF(
element,
configOptions,
enterCallback,
exitCallback,
this.addRAF.bind(this, element.id),
this.removeRAF.bind(this, element.id)
);
});
}
const isTearingDown = this.isDestroyed || this.isDestroying;
const viewportEntered = element.getAttribute('data-in-viewport-entered') === "true";
if (!isTearingDown && (viewportSpy || viewportEntered)) {
set(this, 'viewportEntered', true);
this.trigger('didEnterViewport');
}
}
const exitCallback = () => {
const isTearingDown = this.isDestroyed || this.isDestroying;
if (!isTearingDown && viewportSpy) {
set(this, 'viewportEntered', false);
this.trigger('didExitViewport');
}
}
startRAF(
element,
{ scrollableArea, viewportTolerance, viewportSpy },
enterCallback,
exitCallback,
inViewport.addRAF.bind(inViewport, element.id),
inViewport.removeRAF.bind(inViewport, element.id)
);
} else {
return scheduleOnce('afterRender', this, () => {
this._setViewportEntered(element);
});
}
},