Skip to content

Commit 1732a99

Browse files
authoredJun 28, 2021
Merge pull request #404 from chriskrycho/patch-1
Document the rest of the did-intersect API
2 parents c58a7d3 + 5b66e8e commit 1732a99

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎tests/dummy/app/templates/docs/did-intersect.md

+12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ You can also set a maximum limit on the number of times the callbacks should tri
3535

3636
## Advanced Usage
3737

38+
### Options
39+
3840
`did-intersect` also supports passing an `options` object into IntersectionObserver:
3941

4042
```handlebars
@@ -43,6 +45,16 @@ You can also set a maximum limit on the number of times the callbacks should tri
4345

4446
The options supported are documented in the MDN site under [Intersection observer options](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver#Intersection_observer_options).
4547

48+
### Other arguments
49+
50+
Besides `onEnter`, `onExit`, and `options`, `{{did-intersect}}` accepts the following named arguments:
51+
52+
- `maxEnter`: a maximum number of times to allow the `IntersectionObserver` to be triggered for entering the viewport
53+
54+
- `maxExit`: a maximum number of times to allow the `IntersectionObserver` to be triggered for entering the viewport
55+
56+
- `isObserving`: whether to allow the `IntersectionObserver` to trigger at all. Useful for times when you want to programmatically control enabling and disabling observation of an element based on some tracked state in your own code.
57+
4658
## Testing
4759
Since the underlying IntersectionObserver behavior is non-deterministic, we provide a `did-intersect-mock` test helper to help you test `did-intersect` deterministically.
4860

0 commit comments

Comments
 (0)
Failed to load comments.