Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forgot removeRAF in recursive fn #188

Merged
merged 1 commit into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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