PostStreamState
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
|
|
public |
The description to render on the scrubber. |
|
public |
The discussion to display the post stream for. |
|
public |
When the page is scrolled, goToIndex is called, or the page is loaded, various listeners result in the scrubber being updated with a new position and values. |
|
public |
|
|
public |
loadNext: * |
|
public |
loadPageTimeouts: {} |
|
public |
loadPrevious: * |
|
public |
loadPromise: * |
|
public |
|
|
public |
|
|
public |
|
|
public |
Whether or not the infinite-scrolling auto-load functionality is disabled. |
|
public |
targetPost: {"number": *} |
|
public |
The number of posts that are currently visible in the viewport. |
|
public |
visibleEnd: * |
|
public |
visibleStart: * |
Method Summary
Public Methods | ||
public |
Get the total number of posts in the discussion. |
|
public |
Check whether or not the scrubber should be disabled, i.e. |
|
public |
Load and scroll up to the first post in the discussion. |
|
public |
Load and scroll to a certain index within the discussion. |
|
public |
Load and scroll down to the last post in the discussion. |
|
public |
goToNumber(number: number | String, noAnimation: Boolean): Promise Load and scroll to a post with a certain number. |
|
public |
loadNearIndex(index: number): Promise Clear the stream and load posts near a certain index. |
|
public |
loadNearNumber(number: number): Promise Clear the stream and load posts near a certain number. |
|
public |
Load a page of posts into the stream and redraw. |
|
public |
Load and inject the specified range of posts into the stream, without clearing it. |
|
public |
Get the visible page of posts. |
|
public |
Reset the stream so that a specific range of posts is displayed. |
|
public |
sanitizeIndex(index: number): * Make sure that the given index is not outside of the possible range of indexes in the discussion. |
|
public |
Set up the stream with the given array of posts. |
|
public |
update(): * Update the stream so that it loads and includes the latest posts in the discussion, if the end is being viewed. |
|
public |
Are we currently viewing the end of the discussion? |
Private Methods | ||
private |
Load the next page of posts. |
|
private |
Load the previous page of posts. |
Public Constructors
public constructor() source
Public Members
public animateScroll: * source
public forceUpdateScrubber: Boolean source
When the page is scrolled, goToIndex is called, or the page is loaded, various listeners result in the scrubber being updated with a new position and values. However, if goToNumber is called, the scrubber will not be updated. Accordingly, we add logic to the scrubber's onupdate to update itself, but only when needed, as indicated by this property.
public loadNext: * source
public loadPageTimeouts: {} source
public loadPrevious: * source
public loadPromise: * source
public paused: Boolean source
Whether or not the infinite-scrolling auto-load functionality is disabled.
public targetPost: {"number": *} source
public visibleEnd: * source
public visibleStart: * source
Public Methods
public disabled(): Boolean source
Check whether or not the scrubber should be disabled, i.e. if all of the posts are visible in the viewport.
public goToIndex(index: number, noAnimation: Boolean): Promise source
Load and scroll to a certain index within the discussion.
public goToNumber(number: number | String, noAnimation: Boolean): Promise source
Load and scroll to a post with a certain number.
public loadNearIndex(index: number): Promise source
Clear the stream and load posts near a certain index. A page of posts surrounding the given index will be loaded. Returns a promise. If the given index is already loaded, the promise will be resolved immediately.
Params:
Name | Type | Attribute | Description |
index | number |
public loadNearNumber(number: number): Promise source
Clear the stream and load posts near a certain number. Returns a promise. If the post with the given number is already loaded, the promise will be resolved immediately.
Params:
Name | Type | Attribute | Description |
number | number |
public loadPage(start: number, end: number, backwards: Boolean) source
Load a page of posts into the stream and redraw.
public loadRange(start: number, end: number): Promise source
Load and inject the specified range of posts into the stream, without clearing it.
public reset(start: number, end: number) source
Reset the stream so that a specific range of posts is displayed. If a range is not specified, the first page of posts will be displayed.
public sanitizeIndex(index: number): * source
Make sure that the given index is not outside of the possible range of indexes in the discussion.
Params:
Name | Type | Attribute | Description |
index | number |
Return:
* |
public show(posts: Post[]) source
Set up the stream with the given array of posts.
Params:
Name | Type | Attribute | Description |
posts | Post[] |
public update(): * source
Update the stream so that it loads and includes the latest posts in the discussion, if the end is being viewed.
Return:
* |