Skip to content

Commit 7ee4613

Browse files
committed
trigger a ready event
1 parent 812ddc7 commit 7ee4613

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/events.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ ias.once('appended', handler);
2020

2121
## Reference
2222

23+
### ready
24+
25+
This event is triggered when the DOM is ready. Right after this event Infinite Ajax Scroll will bind (unless the [`bind`](./options.md#bind) option is set to `false`).
26+
2327
### binded
2428

2529
This event is triggered when Infinite Ajax Scroll binds to the scroll and resize events of the scroll container. This mostly happens right after the DOM is ready, but this can be configured with the `bind` option.

src/events.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const LOADED = 'loaded';
88
export const ERROR = 'error';
99
export const LAST = 'last';
1010
export const NEXT = 'next';
11+
export const READY = 'ready';
1112
export const SCROLLED = 'scrolled';
1213
export const RESIZED = 'resized';
1314
export const PAGE = 'page';
@@ -25,6 +26,7 @@ const events = {
2526
ERROR,
2627
LAST,
2728
NEXT,
29+
READY,
2830
SCROLLED,
2931
RESIZED,
3032
PAGE,

src/infinite-ajax-scroll.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ export default class InfiniteAjaxScroll {
8181

8282
this.ready = true;
8383

84+
this.emitter.emit(Events.READY);
85+
8486
if (this.bindOnReady && this.options.bind) {
8587
this.bind();
8688
}

0 commit comments

Comments
 (0)