Skip to content

Commit 14d0195

Browse files
committed
chore: readme
1 parent dfd0402 commit 14d0195

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

readme.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ or
1818
## Methods
1919

2020
### ping
21-
`XObserver.ping(scope: string, options: IntersectionObserverInit): void`
21+
`XObserver.ping(scope: string, options?: IntersectionObserverInit, defCallback?: XObserverCallback)): void`
22+
23+
Initialize/prepare one IntersectionObserver per given scope. A default callback for each subscriber can also be provided at the scope level, using defCallback. This can be called multiple times, only the first call will create an actual instance.
24+
25+
- A new scope must be pinged if another set of options is required
26+
- defCallback for an element will be ignored if a callback was provided for that element during `.subscribe`
2227

23-
Initialize/prepare one IntersectionObserver per given scope. This can be called multiple times, only the first call will create an actual instance. (note: a new scope must be pinged if another set of options is required)
2428

2529

2630
### subscribe
27-
`XObserver.subscribe(scope: string, element: Element, callback: XObserverCallback): void`
31+
`XObserver.subscribe(scope: string, element: Element, callback?: XObserverCallback): void`
2832

2933
Subscribe the element to the observer. Be aware that the callback provided is invoked only for given particular element.
30-
(note: The element must have a unique ID assigned to it)
34+
- The element must have a unique ID assigned to it
3135

3236
### unsubscribe
3337
`XObserver.unsubscribe(scope: string, element: Element): void`

0 commit comments

Comments
 (0)