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

Pass more data back to callbacks #227

Open
mehulkar opened this issue Feb 26, 2020 · 0 comments
Open

Pass more data back to callbacks #227

mehulkar opened this issue Feb 26, 2020 · 0 comments

Comments

@mehulkar
Copy link
Contributor

mehulkar commented Feb 26, 2020

The onEnter and onExit callbacks currently receive the watched element as the first argument. It would be useful to receive the options that were passed when registering the callback as well.

My use case is currently only for testing. I want to test that the correct value is passed for the scrollableArea option. It's a bit hard to write a test that actually asserts the behavior of IntersectionObserver and its implementation of the root argument. Since my abstraction for IO is this addon, I could write my test case to the API provided here instead.

Something like this:

<div {{in-viewport onEnter=this.foo scrollableArea=".something"}}>

{{!-- 
function foo(element, options) {
  assert.equal(options.scrollableArea, '.something');
}
--}}

I think this could be achieved by binding these options before adding them to rafAdmin or observerAdmin when adding the callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant