Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

Commit

Permalink
Add test method documentation to README
Browse files Browse the repository at this point in the history
  • Loading branch information
camwiegert committed Oct 7, 2016
1 parent b236c26 commit e2d0810
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Expand Up @@ -36,7 +36,7 @@ inView('.someSelector')

## API

in-view maintains a separate handler registry for each set of elements captured with `inView(<selector>)`. Each registry exposes the same four methods. in-view also exposes three top-level methods. (`is`, `offset`, `threshold`).
in-view maintains a separate handler registry for each set of elements captured with `inView(<selector>)`. Each registry exposes the same four methods. in-view also exposes four top-level methods. (`is`, `offset`, `threshold`, `test`).

### inView(\<selector>).on(\<event>, \<handler>)
> Register a handler to the elements selected by `selector` for `event`. The only events in-view emits are `'enter'` and `'exit'`.
Expand Down Expand Up @@ -85,7 +85,15 @@ in-view maintains a separate handler registry for each set of elements captured
> inView.threshold(0);
> inView.threshold(0.5);
> inView.threshold(1);
> ```
> ```
### inView.test(\<test>)
> Override in-view's default visibility criteria with a custom function. This function will receive the element and the options object as its only two arguments. Return `true` when an element should be considered visible and `false` otherwise.
> ```js
> inView.test((el, options) => {
> // ...
> });
> ```
### inView(\<selector>).check()
> Manually check the status of the elements selected by `selector`. By default, all registries are checked on `window`'s `scroll`, `resize`, and `load` events.
Expand Down

0 comments on commit e2d0810

Please sign in to comment.