Reference Source
import PostStream from 'flarum/components/PostStream'
public class | source

PostStream

Extends:

src/common/Component.js~Component → PostStream

The PostStream component displays an infinitely-scrollable wall of posts in a discussion. Posts that have not loaded will be displayed as placeholders.

Attrs

  • discussion
  • stream
  • targetPost
  • onPositionChange

Member Summary

Public Members
public
public
public
public

stream: *

Method Summary

Public Methods
public

Work out which posts (by number) are currently visible in the viewport, and fire an event with the information.

public

flashItem($item: jQuery)

'Flash' the given post, drawing the user's attention to it.

public

getMarginTop(): Integer

Get the distance from the top of the viewport to the point at which we would consider a post to be the first one visible.

public

oncreate(vnode: *)

public

oninit(vnode: *)

public
public

onscroll(top: Integer)

When the window is scrolled, check if either extreme of the post stream is in the viewport, and if so, trigger loading the next/previous page.

public
public

scrollToIndex(index: Integer, animate: Boolean, reply: Boolean): jQuery.Deferred

Scroll down to a certain post by index.

public

scrollToItem($item: jQuery, animate: Boolean, force: Boolean, reply: Boolean): jQuery.Deferred

Scroll down to the given post.

public

scrollToNumber(number: Integer, animate: Boolean): jQuery.Deferred

Scroll down to a certain post by number and 'flash' it.

public

Start scrolling, if appropriate, to a newly-targeted post.

public

updateScrubber(top: *)

public

view(): *

Public Members

public calculatePositionTimeout: * source

public discussion: * source

public scrollListener: * source

public stream: * source

Public Methods

public calculatePosition(top: *) source

Work out which posts (by number) are currently visible in the viewport, and fire an event with the information.

Params:

NameTypeAttributeDescription
top *
  • optional

public flashItem($item: jQuery) source

'Flash' the given post, drawing the user's attention to it.

Params:

NameTypeAttributeDescription
$item jQuery

public getMarginTop(): Integer source

Get the distance from the top of the viewport to the point at which we would consider a post to be the first one visible.

Return:

Integer

public oncreate(vnode: *) source

Params:

NameTypeAttributeDescription
vnode *

public oninit(vnode: *) source

Params:

NameTypeAttributeDescription
vnode *

public onremove() source

public onscroll(top: Integer) source

When the window is scrolled, check if either extreme of the post stream is in the viewport, and if so, trigger loading the next/previous page.

Params:

NameTypeAttributeDescription
top Integer

public onupdate() source

public scrollToIndex(index: Integer, animate: Boolean, reply: Boolean): jQuery.Deferred source

Scroll down to a certain post by index.

Params:

NameTypeAttributeDescription
index Integer
animate Boolean
reply Boolean

Whether or not to scroll to the reply placeholder.

Return:

jQuery.Deferred

public scrollToItem($item: jQuery, animate: Boolean, force: Boolean, reply: Boolean): jQuery.Deferred source

Scroll down to the given post.

Params:

NameTypeAttributeDescription
$item jQuery
animate Boolean
force Boolean

Whether or not to force scrolling to the item, even if it is already in the viewport.

reply Boolean

Whether or not to scroll to the reply placeholder.

Return:

jQuery.Deferred

public scrollToNumber(number: Integer, animate: Boolean): jQuery.Deferred source

Scroll down to a certain post by number and 'flash' it.

Params:

NameTypeAttributeDescription
number Integer
animate Boolean

Return:

jQuery.Deferred

public triggerScroll() source

Start scrolling, if appropriate, to a newly-targeted post.

public updateScrubber(top: *) source

Params:

NameTypeAttributeDescription
top *
  • optional

public view(): * source

Return:

*