Methods
(static) getContentCardMap()
- Description:
- Fetch any content IDs with some progress, include the userPinnedItem,
and generate a map of the cards keyed by the content IDs
- Source:
(static) getProgressRows(optionsopt) → {Promise.<Object>}
- Description:
- Fetches and combines recent user progress rows and playlists, excluding certain types and parents.
- Source:
Example
getProgressRows({ brand: 'drumeo', limit: 10 })
.then(data => console.log(data))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
options |
Object
|
<optional>
|
{}
|
Options for fetching progress rows.
Properties
| Name |
Type |
Attributes |
Default |
Description |
brand |
string
|
null
|
<optional>
|
null
|
The brand context for progress data. |
limit |
number
|
<optional>
|
8
|
Maximum number of progress rows to return. |
|
Returns:
- A promise that resolves to an object containing progress rows formatted for UI.
-
Type
-
Promise.<Object>
(static) getUserPinProgressKey()
- Description:
- Gets the localStorage key for user pinned progress, scoped by user ID
- Source:
(static) pinProgressRow(brand, id, progressType) → {Promise.<Object>}
- Description:
- Pins a specific progress row for a user, scoped by brand.
- Source:
Example
pinProgressRow('drumeo', 12345, 'content')
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
string
|
The brand context for the pin action. |
id |
number
|
string
|
The ID of the progress item to pin. |
progressType |
string
|
The type of progress (e.g., 'content', 'playlist'). |
Returns:
- A promise resolving to the response from the pin API.
-
Type
-
Promise.<Object>
(static) unpinProgressRow(brand) → {Promise.<Object>}
- Description:
- Unpins the current pinned progress row for a user, scoped by brand.
- Source:
Example
unpinProgressRow('drumeo', 123456)
.then(response => console.log(response))
.catch(error => console.error(error));
Parameters:
| Name |
Type |
Description |
brand |
string
|
The brand context for the unpin action. |
Returns:
- A promise resolving to the response from the unpin API.
-
Type
-
Promise.<Object>
(async, inner) getUserPinnedItem(brand) → {Promise.<(any|*|{id, type})>}
- Description:
- Retrieves user's pinned data by brand, from localStorage or BE call.
- Source:
Parameters:
| Name |
Type |
Description |
brand |
|
|
Returns:
-
Type
-
Promise.<(any|*|{id, type})>
(async, inner) popPinnedItem()
- Description:
- Pop the userPinnedItem from cards and return it.
If userPinnedItem is not found, generate the pinned card from scratch.
- Source:
(inner) sortCards()
- Description:
- Order cards by progress timestamp, move pinned card to the front,
remove any duplicate cards showing the same content twice,
slice the result based on the provided limit.
- Source: