Skip to content

Commit

Permalink
Forgot removeRAF in recursive fn (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer authored Apr 23, 2019
1 parent d1ba79c commit 2e5af37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion addon/-private/raf-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export function startRAF(
{ scrollableArea, viewportTolerance, viewportSpy },
enterCallback,
exitCallback,
addRAF
addRAF,
removeRAF
)
);
} else {
Expand Down
10 changes: 7 additions & 3 deletions addon/services/in-viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ export default class InViewport extends Service {
const {
enterCallback = noop,
exitCallback = noop
} = get(this, 'rafAdmin').getCallbacks(element) || {};
} = 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.elementId),
this.removeRAF.bind(this, element.elementId)
this.addRAF.bind(this, element.id),
this.removeRAF.bind(this, element.id)
);
});
}
Expand Down Expand Up @@ -111,6 +111,10 @@ export default class InViewport extends Service {
}
}

getCallbacks(target) {
return get(this, 'rafAdmin').getCallbacks(target);
}

/** IntersectionObserver **/

/**
Expand Down

0 comments on commit 2e5af37

Please sign in to comment.