Reference Source
import DiscussionListState from 'flarum/states/DiscussionListState'
public class | source

DiscussionListState

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

app: *

public
public
public
public

params: *

Method Summary

Public Methods
public

addDiscussion(discussion: *)

Add a discussion to the top of the list.

public

clear()

Clear cached discussions.

public

empty(): *

Have the search results come up empty?

public

getParams(): *

Get the search parameters.

public

Are there discussions stored in the discussion list state?

public

isLoading(): *

Are discussions currently being loaded?

public

In the last request, has the user searched for a discussion?

public

Load the next page of discussion results.

public

loadResults(offset: *): *

Load a new page of discussion results.

public

parseResults(results: *): *

Parse results and append them to the discussion list.

public

refresh(objectPattern: {"clear": *}): *

Clear and reload the discussion list.

public

refreshParams(newParams: *)

If there are no cached discussions or the new params differ from the old ones, update params and refresh the discussion list from the database.

public

removeDiscussion(discussion: *)

Remove a discussion from the list if it is present.

public

Get the parameters that should be passed in the API request to get discussion results.

public

sortMap(): *

Get a map of sort keys (which appear in the URL, and are used for translation) to the API sort value that they represent.

Public Constructors

public constructor() source

Public Members

public app: * source

public discussions: *[] source

public loading: boolean source

public moreResults: boolean source

public params: * source

Public Methods

public addDiscussion(discussion: *) source

Add a discussion to the top of the list.

Params:

NameTypeAttributeDescription
discussion *

public clear() source

Clear cached discussions.

public empty(): * source

Have the search results come up empty?

Return:

*

public getParams(): * source

Get the search parameters.

Return:

*

public hasDiscussions(): * source

Are there discussions stored in the discussion list state?

Return:

*

public isLoading(): * source

Are discussions currently being loaded?

Return:

*

public isSearchResults(): * source

In the last request, has the user searched for a discussion?

Return:

*

public loadMore() source

Load the next page of discussion results.

public loadResults(offset: *): * source

Load a new page of discussion results.

Params:

NameTypeAttributeDescription
offset *

The index to start the page at.

Return:

*

public parseResults(results: *): * source

Parse results and append them to the discussion list.

Params:

NameTypeAttributeDescription
results *

Return:

*

public refresh(objectPattern: {"clear": *}): * source

Clear and reload the discussion list.

Params:

NameTypeAttributeDescription
objectPattern {"clear": *}
  • optional
  • default: {}

Return:

*

public refreshParams(newParams: *) source

If there are no cached discussions or the new params differ from the old ones, update params and refresh the discussion list from the database.

Params:

NameTypeAttributeDescription
newParams *

public removeDiscussion(discussion: *) source

Remove a discussion from the list if it is present.

Params:

NameTypeAttributeDescription
discussion *

public requestParams(): * source

Get the parameters that should be passed in the API request to get discussion results.

Return:

*

public sortMap(): * source

Get a map of sort keys (which appear in the URL, and are used for translation) to the API sort value that they represent.

Return:

*