InfiniteScrollRouteMixin Class
A mixin for routes that need infinite scrolling.
Item Index
Methods
Properties
Events
Methods
_resetProperties
()
private
Resets the property defined by infiniteIncrementProperty
on
willTransition
.
_updateInfiniteCount
(
private
-
addedLength
Increments a property after the infinite scroll is finished.
Parameters:
-
addedLength
Numberthe incremental length of the model
_updateScrollProperties
(
private
-
addedLength
Calls
_updateInfiniteCount
and updateInfiniteAvailable
.
Parameters:
-
addedLength
Numberthe incremental length of the model
afterInfiniteQuery
(
-
newRecords
Record processing or anything else that needs to happen with the returned
records.
Parameters:
-
newRecords
Objectthe records returned in this cycle
beforeInfiniteQuery
(
-
params
Called immediately before the infinite query starts.
Parameters:
-
params
Objectthe params that will be used in the query
beforeModel
()
Sets defaults for infiniteScrollAvailable
and hasMoreContent
infiniteQuery
(
Promise
-
modelName
-
params
The query that will be used.
Parameters:
-
modelName
Stringthe name of the model -
params
Objectthe params that will be used in the query
Returns:
Promise:
the records
performInfinite
(
Promise
-
modelName
-
params
Does what's needed for the infinite scroll.
- sets
infiniteQuerying
to true
- if passed modelName
, sets infiniteModelName
- if passed params
, sets infiniteQueryParams
- calls beforeInfiniteQuery
- calls infiniteQuery
then:
- calls afterInfiniteQuery
- calls _updateInfiniteProperties
- sets infiniteQuerying
to false
Parameters:
-
modelName
Stringthe model to be queried -
params
Objectparams to use in the query
Returns:
Promise:
the records
updateHasMoreContent
(
-
addedLength
Determines whether the infinite scroll should continue after it finishes.
Parameters:
-
addedLength
Numberthe incremental length of the model
Properties
_cycleCount
Number
private
The number of queries that have cycled.
Default: 0
_fullQueryParams
Unknown
private
The default parameters.
Default: ['start', 'limit']
hasMoreContent
Boolean
True if it should continue making calls for new content.
infiniteContentPropertyName
String
The name of the model that the infinite content will be added to.
Default: 'controller.model'
infiniteIncrementBy
String
The property that will increment
infiniteIncrementProperty
.
Default: 'limit'
infiniteIncrementProperty
String
The property that will be incremented after each cycle.
Default: 'start'
infiniteModelType
String
The model name that will be queried.
Default: ''
infiniteQuerying
Boolean
True if a query has been started but not finished.
infiniteQueryParams
Array
An array of params that are needed for the infinite query.
Default: []
infiniteScrollAvailable
Boolean
True if the infinite scroll can be used.
limit
Number
The limit param.
Default: 12
start
Number
The start param.
Default: 0
Events
performInfinite
Debounces
_performInfinite